RESTlets
The adapter can model RESTlets as views. This section shows how to use the included RESTlet script to query saved searches, including how to fine-tune the table schemas to represent your saved searches more closely.
Using RESTlets vs. the SavedSearches View
Using RESTlets is the recommended way to query saved searches. Using RESTlets is different than the method described in
Saved Searches. This older method relies on the SuiteTalk API, which is more limited in what saved searches may return.
Using RESTlets to Query Saved Searches
Follow the steps below to deploy the included script and execute the RESTlet by executing a SELECT query:
Enable SuiteScript
Go to Setup -> Company -> Enable Features. Under the SuiteCloud tab, ensure the options for Client SuiteScript, Server SuiteScript, and SuiteScript Server Pages are all enabled.
Upload the SuiteScript File
Go to Documents -> Files -> SuiteScripts. Click the Add File button. Upload the search_script.js script that is included with the NetSuite Adapter. You can find it in the installation directory, under the db folder.
Create a Script Record
Go to Customization -> Scripting -> Scripts -> New. From the menu, find search_script.js and select it. Then click Create Script Record.
Deploy the Script Record
Give the script a name and under the Deployments tab add a title. Then click Save. This will create a deployment.
Note: While the status of the Script Deployment is Testing, only the user that created the deployment will return results from any saved searches queried. To make the RESTlet available for other users, update the Status of the Script Deployment to Released and add supported roles in the Audience tab.
Get the Deployment / Script Id
You will find a link to the deployment in the Script Record. Follow the link to the deployment. Or, you can also go to Customization -> Scripting -> Script Deployments and use the filters to find the deployment you made. In the deployment record, you will see a URL and External URL. Copy the script number and deployment number from this URL.
Get a Saved Search Id
To execute search_script.js, you need to pass it the Id of a saved search: Go to Lists -> Search -> Saved Searches and copy in the Id of a saved search. We recommend you use a search that is ordered by a column that will always give the same ordering, such as the Date Created. This is because NetSuite does not cache results that can cause duplicates or missing data if data is changed while you are paging through the results.
Configure Authentication
RESTlets support the following authentication mechanisms:
• User/Password: You must set the UseSessions connection property to true in addition to User and Password.
• OAuth: In addition to the OAuth connection properties, the AccountId is required for RESTlet OAuth authentication. To authenticate, set AccountId, OAuthClientId, OAuthClientSecret, OAuthAccessToken, and OAuthAccessTokenSecret.
See for a connection guide.