Aaron McCausland
03/31/2025, 9:30 PMCeligo AI
03/31/2025, 9:30 PMAI generated answer (using internal Slack threads):To create a parenthetical OR group and add it to the conditions array of an existing loaded saved search object in SuiteScript 2.1 without overwriting the whole filter expression, you can follow these steps: 1. Load the saved search using the
search.load
method and get the existing filter expression using the filterExpression
property.
2. Create a new filter expression for the OR condition. This should be an array of arrays where each inner array represents a condition and the string 'OR' is used to combine them. For example, [ ['field1', 'operator1', 'value1'], 'OR', ['field2', 'operator2', 'value2'] ]
.
3. Add the new filter expression to the existing one. You can use the push
method to add the new filter expression to the existing one. However, since filterExpression
is a getter and setter, you need to set the filterExpression
property rather than calling methods on it. Here is an example:
javascript
var mySearch = search.load({id: 'customsearch_my_search'});
var existingFilterExpression = mySearch.filterExpression;
var newFilterExpression = [ ['field1', 'operator1', 'value1'], 'OR', ['field2', 'operator2', 'value2'] ];
existingFilterExpression.push(newFilterExpression);
mySearch.filterExpression = existingFilterExpression;
4. Run the search with the updated filter expression.
Remember, the filterExpression
property of a search object is a complex structure that can contain nested arrays to represent parenthetical groups of conditions. The 'AND' and 'OR' strings are used to combine conditions and groups of conditions.
******
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
03/31/2025, 9:31 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811835825
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810350716
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80907017
Celigo AI
03/31/2025, 9:31 PM