JB
05/29/2025, 5:41 PMCeligo AI
05/29/2025, 5:41 PMAI generated answer (using internal Slack threads):In SuiteScript, you can use a search in a workflow action script by using the
N/search
module. This module allows you to create, run, and manipulate searches in NetSuite.
Here's a basic example of how you can use a saved search in a workflow action script:
javascript
var search = require('N/search');
function onAction(context) {
var savedSearch = search.load({
id: 'customsearch_my_saved_search' // replace with your saved search id
});
var resultSet = savedSearch.run();
var results = resultSet.getRange({
start: 0,
end: 100
});
for (var i = 0; i < results.length; i++) {
var result = results[i];
// process each result
}
}
In this example, the search.load
function is used to load a saved search. The run
method is then called on the saved search to execute it and return a result set. The getRange
method is used to retrieve a specific range of results from the result set.
However, please note that in order to use a saved search in a workflow, the saved search must be of the same type of record that the workflow is triggered on. For example, if your workflow is triggered on a Sales Order (SO), your saved search must also be a Sales Order search.
If you need to use a different type of saved search (for example, an Item saved search on a Transaction record), you may need to use a third-party solution or custom scripting. For example, there are bundles available that provide enhanced workflow actions, which may be able to meet your needs.
******
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/29/2025, 5:41 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846342504
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837410152
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83726728
Celigo AI
05/29/2025, 5:41 PMMemoona Ilyas
05/29/2025, 6:36 PMShow all overdue invoices by customer over $10K
What’s our trailing 12-month cash flow by department?— all without needing to create a saved search or script. So while SuiteReport won’t directly help you build a SuiteScript action, it reduces the need for those actions in the first place, especially for reporting, finance workflows, and self-service insights. It has made my life so easy tbh.