Luis
08/29/2024, 8:02 PMvar loadedSearch = search.load({
id: searchId
});
var filter = search.createFilter({
name: 'formulanumeric',
operator: search.Operator.EQUALTO,
values: 1,
formula: "CASE WHEN {entityid} IN ('" + customerIds.join("','") + "') THEN 1 ELSE 0 END"
});
loadedSearch.filters = []; // what should I do here?
loadedSearch.save();
Celigo AI
08/29/2024, 8:02 PMAI generated answer (using internal Slack threads):To apply the filter to the search before saving, you should push the filter into the filters array of the loaded search. Here is how you can do it:
javascript
var loadedSearch = search.load({
id: searchId
});
var filter = search.createFilter({
name: 'formulanumeric',
operator: search.Operator.EQUALTO,
values: 1,
formula: "CASE WHEN {entityid} IN ('" + customerIds.join("','") + "') THEN 1 ELSE 0 END"
});
loadedSearch.filters.push(filter);
loadedSearch.save();
In the above code, loadedSearch.filters.push(filter);
is used to add the created filter to the filters array of the loaded search. After this, when you save the search, the filter will be applied.
******
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
08/29/2024, 8:02 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.8413288
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836599767
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836417913
Celigo AI
08/29/2024, 8:02 PM