Let say, there is a script(SetValueAtSaveRecord.js) deployed for all records present in netsuite. But, there is a function(SetLocation() ) in that script which should be applied for a particular record(like transaction record). How to do this?
First, we should check the common word comes in the url of that particular record loading page.
Like, in the page of all types of transaction record(sales record,cash sale record,customer payment record,inventory record and all), ‘transactions‘ -this word coms in the url.
So, in the main function SetAtSaveREcord() of SetValueAtSaveRecord.js,
1. first we need to fetch the url of record page (by using document.url),
2. then, we should search for the common word(‘transactions’) in the url,
3. if the word found in the url, means the record is of transaction record,
4. then we will call the function SetLocation() which should be applied only for transaction record.
//called in 'save record event' in SetValueAtSaveRecord.js script
var url = document.URL;
//'transactions' is present in the url of all the transaction records. So,it checks for
//transaction records using search('transactions'). url.search('transactions') != -1
//means no match for 'transaction' word
if (url.search('transactions') != -1)
//set location field for all transaction records
//more functions are there applied for all records
//Set location field