aaz
10/31/2024, 12:05 PMCeligo AI
10/31/2024, 12:05 PMAI generated answer (using internal Slack threads):To dynamically add more filters while using the saved search in SuiteScript, you can use the
filterExpression
property of the search object. Here's how you can do it:
First, you need to load the saved search:
javascript
var mySearch = search.load({
id: 'customsearch_my_saved_search'
});
Then, get the existing filter expression:
javascript
var existingFilters = mySearch.filterExpression;
Next, create your new filter:
javascript
var newFilter = ['your', 'added', 'filter'];
Then, add your new filter to the existing filter expression:
javascript
existingFilters.push(newFilter);
Finally, set the updated filter expression back to the search:
javascript
mySearch.filterExpression = existingFilters;
Alternatively, you can use the concat
method to add the new filter:
javascript
mySearch.filterExpression = mySearch.filterExpression.concat(newFilter);
Please note that you can't directly call search.filterExpression.push(newFilter);
because search.filters
and search.filterExpression
are getters and setters around an internal object. You need to set the filterExpression
property rather than calling methods on it.
******
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/31/2024, 12:06 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.869998097
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844520509
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83398515
Celigo AI
10/31/2024, 12:06 PM