10.07.2015 Views

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Web</strong> <strong>Services</strong> Operationssearch211• How do I reference an existing saved search?Why reference an existing saved search?The following use cases illustrate possible scenarios for referencing a saved search:• You want to return only a subset of data from a record (in other words, data that isspecified through the saved search’s return columns).• Your integration application processes a set of records that are identified in a savedsearch. Periodically, users change the criteria of the search. By referencing a savedsearch ID, your code can just reference their saved search. Developers do not have tochange and re-test code every time the search criteria changes.• You have a complex search that compiles data from many different records. You cancreate a saved search in the <strong>NetSuite</strong> UI, and then reference this search in <strong>Web</strong> servicesrather than try to code the search in <strong>Web</strong> services.• You want to reference an existing saved search based on Leads, for example. You canreturn all the data provided in this search, and then define additional criteria for thesearch response. For example, you can return a Leads saved search and then provideadditional criteria that returns the leads from this search created with today’s date. Inother words, if you reference a saved search and add any filter criteria to the searchrequest, the additional criteria will be conjunctive with the saved search criteria.How do I reference an existing saved search?First must first obtain the saved search ID. You can do so through the UI by going to Lists >Search > Saved Searches. The saved search ID appears in the ID column.You can also use the getSavedSearch operation to programmatically retrieve a list of savedsearch IDs for a specific record type. Note that this operation does nothing more than return alist of saved search IDs on a per-record-type basis (for example, all saved search IDs for theCustomer record type).You can then use the search() operation, along with the SearchAdvanced object toreturn the details of the saved search. The following is a simple example that shows how toinstantiate the CustomerSearchAdvanced object and specify a savedSearchId to return.// create search objectCustomerSearchAdvanced customerSearch = new CustomerSearchAdvanced();//set saved search idcustomerSearch.savedSearchId="100";// perform the search<strong>NetSuite</strong>Service nss = new <strong>NetSuite</strong>Service();SearchResult result = nss.search(customerSearch);For more detailed samples, see Advanced Search Code Samples.Important: Note the following about saved searches in <strong>Web</strong> services:• Only one saved search can be referenced as part of the search call.<strong>SuiteTalk</strong> <strong>Platform</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!