Friday, November 9, 2018

Search for Saved Searches using SuiteScript

To search for saved searches, we could use nlapiSearchGlobal as the following code snippet demonstrates:

var results = nlapiSearchGlobal('search:filter'); //search for existing saved searches containing the word 'filter' in the name/id
var id = results[0].getId(); //get the internal ID of the saved search
var columns = results[0].getAllColumns();
var searchRecordType = results[0].getValue(columns[2]); //returns the record internal ID the saved search is searching for
var search = nlapiLoadSearch(searchRecordType,id); //loads the actual saved search

No comments:

Post a Comment