Vishal Chaudhari
05/28/2025, 1:04 PMCeligo AI
05/28/2025, 1:04 PMAI generated answer (using internal Slack threads):To fetch the data from a saved search in a script, you can use SuiteScript's
N/search
module. Here's a basic example of how you can do this:
javascript
var search = require('N/search');
// Load the saved search
var mySearch = search.load({
id: 'customsearch_my_saved_search'
});
// Run the search and fetch the results
var searchResult = mySearch.run().getRange({
start: 0,
end: 100
});
// Iterate over the results
for (var i = 0; i < searchResult.length; i++) {
var salesRep = searchResult[i].getValue({
name: 'salesrep'
});
var invoiceNumber = searchResult[i].getValue({
name: 'tranid'
});
var amount = searchResult[i].getValue({
name: 'amount'
});
// Do something with the data...
}
In this example, replace 'customsearch_my_saved_search'
with the internal ID of your saved search. The getValue
function is used to fetch the value of each field in the search result. Replace 'salesrep'
, 'tranid'
, and 'amount'
with the actual field IDs in your saved search.
Remember, this is a basic example and may need to be adjusted based on your specific needs. For example, if your saved search returns more than 1000 results, you'll need to handle paging in your script.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
05/28/2025, 1:05 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851829052
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840097249
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833756924
Celigo AI
05/28/2025, 1:05 PM