raghav
02/21/2025, 11:33 AMCeligo AI
02/21/2025, 11:33 AMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To fetch multiple formula columns from a saved search in SuiteScript, you need to give each column a unique name. This is because NetSuite uses a prefix to determine what type of formula it is. Here is a general approach: 1. Load the saved search using
search.load
.
2. Iterate through all the columns on the search and find the column with the label you are looking for.
3. Use result.getValue
with the same parameters used to create the column to get the value of the column.
Here is a code snippet that demonstrates this:
javascript
var mySearch = search.load({
id: 'customsearch_my_search'
});
var myColumns = mySearch.columns;
for (var i = 0; i < myColumns.length; i++) {
if (myColumns[i].label == 'myLabel') {
var myColumn = myColumns[i];
break;
}
}
mySearch.run().each(function(result) {
var myValue = result.getValue(myColumn);
// Do something with myValue
return true;
});
In this example, replace 'customsearch_my_search'
with the ID of your saved search and 'myLabel'
with the label of the column you are looking for.
Please note that if you don't care about letting people edit the search in the UI, you can create your own filters and columns instead of loading the search. This can be done using search.create
.
Also, please be aware that there is a known issue where the results in the script are missing columns when a search contains multiple formula columns. You may need to create a support case with NetSuite to have this issue fixed.Celigo AI
02/21/2025, 11:33 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83166188
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827111542
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826380849
Celigo AI
02/21/2025, 11:33 AM