Contact Us
A person working at a computer while another watches, and a third points out specific points, illustrating collaboration and communication.

While working with NetSuite Saved Searches, we have found that in certain cases, it is possible to reduce the time it takes to complete a search query by up to 10x by splitting the search into two or more separate searches. This is especially the case if you are using “OR” conditionals in your search and/or if your search is returning thousands of results.

Need to be able to get around NetSuite's 4000 line saved search result limit? Check out our article on Returning Unlimited Saved Search Results in NetSuite!

Example Saved Search and Speed Impact

A concrete example is as follows:

var newSearch = search.create({
       type: "transaction",
       filters: [
           ["mainline", "is", "T"],
           "AND",
           ["type", "anyof", ["CustInvc", "SalesOrd", "CustCred"]],
           "AND",
           [["entity", "is", userId], "OR", ["custbody_ship_to_customer", "is", userId]],
       ],
       columns: [
           search.createColumn({
               name: "tranid",
               sort: search.Sort.ASC,
           }),
           search.createColumn({
               name: "custbody_nsps_vin_number",
               sort: search.Sort.ASC,
           }),
           search.createColumn({
               name: "custbody_nsps_web_ponum",
               sort: search.Sort.ASC,
           }),
           search.createColumn({
               name: "custbody_nsps_web_part_num",
               sort: search.Sort.ASC,
           }),
           "entity",
           "type",
       ],
   });

The above search grabs Sales Orders, Invoices, and Credits for the logged-in user as well as any of those transactions that have the logged-in user set in a custom field (“custbody_ship_to_customer").

This search was taking over 35 seconds to execute for some users. (Which is extremely slow!)

So, how could we split up this example search to try to speed up the time to execute? In this case, we can split the saved search into two searches since there are two filters.

For other saved searches with a larger number of filters, you may find that you need to split your saved search into more than two searches. However, it may not be necessary to always split every filter out into its own search.

Continuing with our example, after we split it out into two searches the first search included just the “["entity", "is", userId]" filter while the second included just the “["custbody_ship_to_customer", "is", userId]" filter.

By splitting this particular search into two separate searches, one for each filter, the execution time was reduced from 35 seconds to less than 4 seconds!


Got stuck on a step in this article?

We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!

 

Related Articles

NetSuite Saved Searches: How to Create, Customize & Schedule Reports

NetSuite saved searches are one of the most useful no-code reporting tools in NetSuite. They let you pull real-time data from transactions, customers, items, vendors, employees, and custom records using filters, result columns, formulas, and scheduled delivery. A well-built saved search can replace recurring manual reporting, support workflows, and surface live operational data on dashboards. If standard NetSuite reports do not give you the exact view you need, saved searches usually fill the gap. You can build searches for overdue invoices, inactive customers, inventory below reorder point, purchase orders past due, pending approvals, and many other use cases without writing code. This guide explains how to create a NetSuite saved search, customize it with formulas and joins, schedule it for email delivery, add it to a dashboard, and avoid common performance and configuration mistakes.

Read the Article Two netsuite consultants seated at a table, reviewing a notebook, with a closed laptop and papers laid out in front of them.

Tagged with Training, Troubleshooting