Milcho Dimkov
10/21/2024, 8:05 AMCeligo AI
10/21/2024, 8:05 AMAI generated answer (using internal Slack threads):Yes, you can load an existing saved search in SuiteScript and then modify the filters. When you load a saved search via ID in SuiteScript, the filters saved with the search also get loaded. To add additional filters, you can use the
push
method to add new filters to the existing array. However, you can't push a plain Object; you'll need to push an actual filter. NetSuite won't automatically call createFilter
on it since you're using the native JS push
method. Here's an example of how you can do it:
javascript
filters.push(search.createFilter(...));
If you have a whole bunch of filters you need to add, you can use the concat
method:
javascript
filters = filters.concat([
filter1Obj,
filter2Obj,
filter3Obj,
...
].map(search.createFilter));
Please note that when you load and run a saved search through SuiteScript, the search criteria defined in the saved search should apply. If you're experiencing discrepancies in the number of records returned, it might be due to the specific filters and columns used in the UI. If you're unable to resolve the issue, you might consider recreating the search in code.
******
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
10/21/2024, 8:05 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86178875
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.853785217
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844708681
Celigo AI
10/21/2024, 8:05 AM