RE: 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”,
     filters:
     [
         [“type”,”anyof”,”CustInvc”],
          “AND”,
          [“mainline”,”is”,”T”],
          “AND”,
         [“number”, searchModule.Operator.ANYOF, invoiceNumbers]
     ],
     columns:
     [
         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?

nathanw Rookie Asked on September 30, 2019 in SuiteScript.
Add Comment
3 Answers

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

Intermediate Answered on September 30, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.