I have a custom record that has a field for an item and a field for location. I have a saved search on that record that already has the columns I want and some beginning criteria that will always be needed. I want to use this search when I am on a Sales Order. I want to store an array of all the item internal ids and location ids on the lines and then pass that as a dynamic filter to this search in SuiteScript 2.0.
According to the documentation this can be done. On the search.Filter page it says "You create a search filter object with search.createFilter(options) and add it to a search.Search object that you create with search.create(options) or load with search.load(options)." However, I do not see any parameter on search.load for this nor a code example of adding it after the load. All examples of using search.Filter are in using it in the search.create function
Thank you for any help you can give.
To create a saved search, you will first define all search criteria and then execute the search using nlapiCreateSearch(type, filters, columns). The search will not be saved until you call the nlobjSearch. saveSearch method.
In Visual Studio Code, open the SuiteCloud project that you want to create the SuiteScript file in. Open the Command Palette and enter suitecloud . From the dropdown list, select SuiteCloud: Create SuiteScript File. From the dropdown list, select the type of SuiteScript file type you want to create and press Enter.
You can push the filter object to the filters property of the search.
searchObj.filters.push(filterObj);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With