Close
Let's Talk
Close

Let's Talk.

Looking for our offices? View locations.

Talking Tech: NetSuite – Performing Powerful Actions from a Saved Search

Let’s Talk Tech.

Accordion’s “Talking Tech” series explores how different CFO Technology solutions can empower finance functions to support organizational strategic initiatives – by implementing business process recommendations, optimizing operations, and capitalizing on value creation opportunities.

Now, let’s take a look at how to leverage some common yet powerful NetSuite saved search to view aggregated business data from your NetSuite database in the form of an easily readable, reusable list.


Dynamically Display Related Record URL Hyperlink in a Saved Search

Imagine a scenario where a user has  Saved Searches created against Sales Order records. The saved 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, and the transaction record from which the Sales Order was created from. A sample output of such a Saved Search can be seen below.

In the case above, the user would like to have a direct link to the transaction from which the Sales Order was created from. Natively, however, the information filled out in the Created From column is simple plaintext rather than a hyperlink. As such, the user would have to manually find that Quote in order to view it.

While manually finding the Quote from which the Sales Order was created from is not a largely time-consuming task, it would be much more convenient if the user could directly access the record from the Saved Search result set. This can conveniently be solved by customizing the column filter by adding a Formula (Text) field containing a single line of HTML code.

Step 1:

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

Step 2:

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

Step 3:

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

 

<a href=https://tstdrv1030806.app.netsuite.com/app/accounting/transactions/estimate.nl?id=’||{createdfrom.internalid}||’>View  ‘||{createdfrom}||’</a>
view raw.html hosted with ❤ by GitHub

 

Step 4:

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

Step 5:

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

Now, a new column will appear on the saved search, containing clickable hyperlinks for the Created From record for each Sale Order result row.  This was accomplished by the line of HTML that was added into the formula field of the Formula (Text) column; the HTML is a simple hyperlink tag that contains a native NetSuite URL for the specific record type, in this case a Quote record. This URL was made to be dynamic, opening a unique Quote record for each Sales Order result, by concatenating the {createdfrom.internalid} field value (the “ || “ symbol is a string concatenation identifier) after the NetSuite records ID request parameter(‘id=’), telling the URL the specific record to open. The {createdfrom} field value is used to display the Quote number/name on the result column.

There is a limitation to the above process, covered below.


Dynamically Display Related Record URL Hyperlink for Multiple Record Types in a Saved Search

The limitation in the previous post’s example is that it only works if there is only one Created From record type, in this case a Quote record. What if there are multiple applicable record types? Look at the following sample result set.

In the above example, there are now two types of records from which a Sales Order can be created from, a Quote record and an Opportunity Record. The previous solution would not work in this case, as the NetSuite URL we are using to create a hyperlink for is specific for a Quote record. However, the built in SQL capabilities found within the Formula columns can be used to rectify this new use case.

Step 1:

Open the Saved Search in edit mode and navigate to the Formula (Text) field that was created earlier.

Step 2:

Replace the HTML code within the formula field with the following:

 

CASE
WHEN {createdfrom.type} IN (Quote) THEN
<a href=https://tstdrv1030806.app.netsuite.com/app/accounting/transactions/estimate.nl?id=||{createdfrom.internalid}||>View  ||{createdfrom}||</a>
WHEN {createdfrom.type} IN (Opportunity) THEN
<a href=https://tstdrv1030806.app.netsuite.com/app/accounting/transactions/opprtnty.nl?id=||{createdfrom.internalid}||>View ||{createdfrom}||</a>
END
view raw.sql hosted with ❤ by GitHub

 

The above code uses SQL statements to dynamically select which URL type to use, either a Quote record URL or an Opportunity record URL, depending on the type of record returned from the {createdfrom.type} field value for each result row. The following should now be the result of the Saved Search.

While the formula we used above resolves the issue brought up in the hypothetical use case, this functionality can be further extended to even more record types! All you have to do is simply add in extra ‘WHEN-IN-THEN’ statements to the formula we created in Step #2 with the record type and the record type’s NetSuite URL.


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.

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.

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.

Step 2:

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

Step 3:

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

 

<a href=https://tstdrv1030806.app.netsuite.com/app/accounting/transactions/salesordermanager.nl?type=approve&id=’||{internalid}||’&whence=>Approve</a>
view raw.html hosted with ❤ by GitHub

 

Step 4:

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

Step 5:

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

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:

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.

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.

About the Author

Christos Zourzoukis
Christos Zourzoukis
Senior Consultant

Christos is a Senior Consultant in CFO Technology Services with over two years of NetSuite scripting and customization experience for various clients. His experience also includes working with 3rd party integration platforms, such as Dell Boomi, to integrate various ERP related systems together.  Read more

Need NetSuite Support? Let's Talk.