• : 1-877-596-8218
  • : sales@aecc.ca
# # #

How to create a button in NetSuite to open a saved search result

Recently I did a customization for one of our customers, to create a SuiteLet to control/monitor the running of the Scheduled Script. One of their requirement is to have a button on the SuiteLet to open the saved search that selected on the page.

The solution is simple and straightforward, if we know the saved search URL, just write “Window.open(URL)” into the button function. the only challenge is to get the saved search URL dynamically by using the Saved Search ID.

We can use the resolveTaskLink() API from “N/url” module to achieve this. Each NetSuite Page has a unique Tasklink ID, and we can use this ID with the Saved Search Internal ID to resolve the URL for any Saved Searches:


Search Results


You can find the full list of TaskLink ID by search the “Task ID” in NetSuite Help.

The Sample code is writing in SuiteScript 2.0

var searchId = configData.custrecord_saved_search_id;
var searchURL = url.resolveTaskLink({id:'LIST_SEARCHRESULTS', params:{"searchid":searchId}});
   id: 'opensearch',
   label: 'Open Search',
   functionName : "window.open('" + searchURL + "');"

The resolveTaskLink has two parameters, and please note that the saved search ID is passed into the API as a value inside the parameter object.