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
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.
https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp

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 Answer

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