This post will discuss how to perform a Button Action from a Saved Search.

Saved Searches are a powerful tool within NetSuite that allow users to view aggregated business data from the company’s NetSuite database in the form of an easily readable, reusable list. While the list itself is dynamically updated whenever a change is made to the database, the data that fills out the columns on the list usually provides static information (i.e. plaintext) along with the occasional hyperlink to a record or related record. However, by making use of the powerful filter and result column parameter options available, one can perform more advanced actions directly from the Saved Search result list.

While the previous use cases and solutions were useful ones ( NetSuite – Performing Powerful Actions from a Saved Search (Part 1 of 4) and NetSuite – Performing Powerful Actions from a Saved Search (Part 2 of 4)), let’s look at another use case that requires performing a more complex action directly from the Saved Search result list. Imagine a scenario where a user has a Saved Search created against Sales Order records. The search displays a list of Sales Orders that are Pending Approval, with columns displaying each Sales Order record’s internal ID, the transaction date, the transaction number, the customer’s name, the transaction record from which the Sales Order was created from, and our newly created Formula (Text) hyperlinks. A sample output of such a Saved Search can be seen below.

Saved Search 3 2

In the case above, the user would like to directly access the ‘Approve’ button, natively found on the Sales Order record itself, from the Saved Search result list. Normally, the user would have to open each Sales Order from the result set, and then click the ‘Approve’ button on the record, as seen below.

Saved Search 3 3

While manually finding, opening, and approving a Sales Order is also not a largely time-consuming task, it would be much more convenient if the user could directly approve the record from the Saved Search result list. This use case can also be solved using the Formula (Text) column field.

 

Performing a Button Action from a Saved Search

Step 1:

Open the Saved Search in edit mode and navigate to the Results tab selection.

 

Saved Search 3 4Step 2:

Add in a Formula (Text) field to the column filter selection.

 

Saved Search 3 4

Step 3:

Add the following line of HTML to the newly created Formula (Text) field column:

Saved Search 3 6

Saved Search 3 7

Step 4:

Add an appropriate label to the Formula (Text) field.

 

Saved Search 3 8

Step 5:

Save & Run the Saved Search. The following output should be displayed.

 

Saved Search 3 9

Now, a new column will appear on the saved search, containing clickable hyperlinks that, when clicked, will approve the specific Sales Order record contained within the same row.  This was accomplished by the line of HTML that was added into the formula field of the Formula (Text) column; the HTML was a simple hyperlink tag that contained a native NetSuite URL that NetSuite uses as the target for a specific button action, in this case, the target link for performing the approve action on a Sales Order. This URL was made to be dynamic by concatenating the {internalid} field value (the “ || “ symbol is a string concatenation identifier) after the NetSuite records ID request parameter, telling the URL to resolve the approval action for the specific Sales Order record.

The target URL for the ‘Approve’ button that performs the approval action on the Sales Order was found by using the browser’s internal “Inspect Element” tool. Simply right click on the ‘Approve’ button found on the Sales Order record and select “Inspect Element”. The following should be displayed:

HTM Code

The “onclick=cancel_approve_order” is the JavaScript function that performs the approval action on the Sales Order record once the button on the record is clicked. To find the specific URL that this JavaScript function calls upon to perform the approval action, right click on the ‘Approve’ button again, and this time select the ‘View Page Source’ option. A new window should open with a lot of HTML code. Search the page for “cancel_approve_order” and move through the search results until the following lines are displayed.

Code

The above highlighting shows how to parse the JavaScript function to find the target URL link that NetSuite uses to perform the approval process on a Sales Order. A similar process can be used on any button action on a record, though some knowledge on how to read JavaScript and HTML code would be required.

In the next and final part of the Preforming Actions from a Saved Search series, we will be covering how to trigger a Suitelet from a Saved Search. Stay tuned!

To learn more about how your business can benefit from using Advanced NetSuite Saved Search functionality,  PLEASE FEEL FREE TO CONTACT US!

About ABACI:

ABACI is a premier NetSuite Solution Provider that provides deep knowledge in both business process and technology architecture. Our team is passionate about NetSuite and has an exclusive commitment to NetSuite. We pride ourselves on providing the highest level of system expertise on its full suite of cloud-based business management applications.