Hi all! I've got a "search restlet" that takes sea...
# suitescript
k
Hi all! I've got a "search restlet" that takes search parameters and returns search results. I updated it to take a "searchId" parameter to load a search instead of creating one ad hoc, but now when I try to add the filters
if (filters.length > 0) searchObj.filters.push(filters);
I get an error
SSS_INVALID_ARRAY_ARGUMENT
. Is there an easy way to add an array of filters to a loaded search or am I going to have to iterate through the array and do a search.createFilter for each element?
e
You will need to grab the existing filters and add your own filters. Search filters is an object not an array.
👍 1
💯 1
k
Cool thanks, I'll try that!
Does the same go for columns?
e
I haven't tried adding columns dynamically 🙂
k
I'll give it a go 😄
It works!
Thank you!!!
How do you add things like "AND" and "OR" in this syntax?
If I throw an "AND" at it I get
Wrong parameter type: filters[3] is expected as Filter.
it also ignores the "values" parameter so I guess that's not a thing?
e
Here's an example of multiple criteria