getSavedSearch
The getSavedSearch operation in SOAP web services enables you to retrieve a list of existing saved search IDs on a per-record-type basis (for example, all saved search IDs for every Customer saved search). Note that after you retrieve the list of saved search IDs, you may need to look in the NetSuite UI to see the criteria defined for the saved search.
This API takes a search record type as a request argument and returns a list of record references of the saved search. For each saved search, the response includes the internalId, scriptId, and name.
SOAP Request
<soap:Body>
<getSavedSearch xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<record searchType="transaction"/>
</getSavedSearch>
</soap:Body>
SOAP Response
<soapenv:Body>
<getSavedSearchResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<platformCore:getSavedSearchResult xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true"/>
<platformCore:totalRecords>5</platformCore:totalRecords>
<platformCore:recordRefList>
<platformCore:recordRef xsi:type="platformCore:CustomizationRef" internalId="26" scriptId="customsearch26">
<platformCore:name>Custom Transaction Search</platformCore:name>
</platformCore:recordRef>
<platformCore:recordRef xsi:type="platformCore:CustomizationRef" internalId="27" scriptId="customsearch27">
<platformCore:name>CC Transaction Search</platformCore:name>
</platformCore:recordRef>
<platformCore:recordRef xsi:type="platformCore:CustomizationRef" internalId="42" scriptId="customsearch42">
<platformCore:name>Returned Items</platformCore:name>
</platformCore:recordRef>
<platformCore:recordRef xsi:type="platformCore:CustomizationRef" internalId="44" scriptId="customsearch44">
<platformCore:name>Ordered More than One Item</platformCore:name>
</platformCore:recordRef>
<platformCore:recordRef xsi:type="platformCore:CustomizationRef" internalId="46" scriptId="customsearch46">
<platformCore:name>Spending Account Average</platformCore:name>
</platformCore:recordRef>
</platformCore:recordRefList>
</platformCore:getSavedSearchResult>
</getSavedSearchResponse>
</soapenv:Body>
Saved Search in REST Web Services
REST web services support the retrieval of and execution of saved searches. You can retrieve both individual saved searches, and lists of saved searches.
REST web services enables you to get a list of existing saved search IDs that are available to the current user and role. Each saved search contains information about its record type.
The operation to retrieve or run saved searches can be executed both synchronously and asynchronously.
REST web services uses the following endpoints for saved search:
-
To retrieve a list of saved searches, use
GET /services/rest/query/v1/savedsearch -
To execute a specific saved search, use
GET /services/rest/query/v1/savedsearch/[savedSearchId]/result
REST Request
The following sample shows how to get a list of saved searches.
Request
GET https://demo123.suitetalk.api.netsuite.com/services/rest/query/v1/savedsearch
Result
{
"links": [
{
"rel": "self",
"href": "https://demo123.suitetalk.api.netsuite.com/services/rest/query/v1/savedsearch/",
"method": "GET"
}
],
"count": 27,
"hasMore": false,
"items": [
{
"links": [],
"id": "customsearch3",
"internalid": "3",
"recordtype": "Execution Results",
"title": "Execution Results Search"
},
{
"links": [],
"id": "customsearch_lsa_contact_msgfr_max_date",
"internalid": "20",
"recordtype": "Contact",
"title": "LSA Contact Message-From Max Date Search"
},
{
"links": [],
"id": "customsearch_lsa_contact_call_max_date",
"internalid": "21",
"recordtype": "Contact",
"title": "LSA Contact Call Max Date Search"
},
{
"links": [],
"id": "customsearch_balance_gt_100",
"internalid": "40",
"recordtype": "Account",
"title": "Account Balance gt 100"
}
...
],
"offset": 0,
"totalResults": 27
}
For more information, see Using Saved Search in REST Web Services