What is the correct syntax for creating a Search that uses the Search Operator ANYOF

When creating a Search with the following filters,

var invoiceSearch = searchModule.create({
     type: “invoice”,
         [“number”, searchModule.Operator.ANYOF, invoiceNumbers]
         searchModule.createColumn({name:"tranid", label: "Document Number"}),
         searchModule.createColumn({name:"createdfrom", label: "Created From"})

Where invoiceNumbers is [“123″,”124″,”125”]

But I get an error,

{“type”:”error.SuiteScriptError”,”name”:”SSS_SEARCH_FOR_EACH_LIMIT_EXCEEDED”,”message”:”No more than 4000 search results may be returned at one time from nlobjSearchResultSet.forEachResult(callback)…}

I was expecting 3 results not 4000+, Am I structuring my filter correctly?

Beginner Asked on September 30, 2019 in SuiteScript.
Add Comment
3 Answer(s)
Best answer

Install the below Chrome Extension, then build your search in the UI and save it, then edit the search and use the Chrome Extension to view the code.

Also, I’d advise you use an array of search.createFilter entries, unless you are doing complicated joins.

Beginner Answered on September 30, 2019.

This extension is pretty clutch. For larger searches, I’ll use this and build them in the UI and then paste my code in.

on October 1, 2019.
Add Comment

Your syntax is correct but you can’t use anyof with a number filter like number. Its for use with selects.

Advanced Answered on September 30, 2019.
Add Comment

Use filter expression for multiple freeform text values ex.

var s = search.create({type:’invoice’})

var f = [

[‘tranid’, ‘is’, ‘INV1’],


[‘tranid’, ‘is’, ‘INV2’]


s.filterExpression = f


Beginner Answered on October 1, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor