Both front-end (SuiteCommerce) and back-end (SuiteScripts) code often require searches. Here are three tips on speeding up your searches.
Be sure not to add unnecessary columns to your search queries, and add all appropriate filters so that you get the exact results you require. Larger searches slow down your script, slow down network traffic, and are generally considered poor code.
Make sure you are running searches only where and when you need the data. For example, nest searches inside conditionals when applicable to make sure they only run in the context you need them to. Also, in the front end, be sure to run searches right before they are needed and not any earlier. For example, if you are displaying a table of search results, do not make an HTTP request for the results until the view displaying them is about to render.
Pagination can substantially reduce a search query's run time, especially for SuiteCommerce. If you ever expect to display (in an extension or Suitelet) more than 20 results at a time, it is highly recommended that you build pagination into your code.
Want to learn more about speeding up searches? Check out this full tutorial article on Speeding Up a Saved Search in NetSuite by Splitting It.
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!
Hopefully, this post gives you something to work with while trying to understand NetSuite and what it can do for your business. If you have general questions about NetSuite, feel free to contact us at any time. Anchor Group is a certified Oracle NetSuite Alliance Partner & Commerce Partner, and is equipped to handle all kinds of NetSuite and SuiteCommerce projects, large or small!
Tagged with SuiteScript, Training