Learn how to create a customization to categorize saved searches

Introduction

My customer wanted to be able to add a description and categorize the saved search.  If he could categorize saved searches using custom fields, he could then create saved searches on saved searches using the custom fields.  That’s a mouthful! I thought this would be a good article so I’ll show you how to get around this limitation using a custom record and some SuiteScript.

Step 1:  Create a custom record “Saved Search Details”

Go to Customization -> Lists, Records, & Fields –Record Types -> New

Fill out your custom record as shown below.  Click “Save & Edit” when done.

 

 

Step 2: Add fields to the custom record

Click the “New Field” Button to add the field.  For all fields, mark “Show In List”.  By checking this field, the field will show in the “Results” tab on a saved search.  After filling out the information for each click “Save”.

Field 1: Saved Search

Make sure to make this mandatory.

  • Label: Saved Search
  • ID: _ssd_saved_search
  • Type: List/Record
  • List/Record: Saved Search

 

Field 2: Saved Search ID

This field will be set by a user event script which is described later.

  • Label: Saved Search ID
  • ID: _ssd_search_id
  • Type: Integer Number
  • Display Type: Inline Text
  • Uncheck “Apply Formatting”

 

Field 3: Edit Search

  • Label: Edit Search
  • This allows the user to edit the search in a new tab.
  • ID: _ssd_edit_search_hyperlink
  • Type: Hyperlink
  • Display Type: Inline Text

On Validation & Defaulting enter this for the default value and check “Formula”

/app/common/search/search.nl?cu=T&e=T&id=’ || {custrecord_ssd_search_id}

 

Field 4: Run Search

  • This allow the user to run the search in a new tab.
  • Label: Run Search
  • ID: _ssd_run_search_hyperlink
  • Type: Hyperlink
  • Display Type: Inline Text

On Validation & Defaulting enter this for the default value and check “Formula”

/app/common/search/searchresults.nl?searchid=’ || {custrecord_ssd_search_id}

 

 

Field 5: Description

  • Label: Description
  • ID: _ssd_description
  • Type: Text Area

Field 6: Group

This is an example of how you would categorize each saved search.  Create a new list of the different groups this search could be a part of.

  • Label: Group
  • ID: _ssd_group
  • Type: List Record

Click the plus sign next to List/Record field and create a new list.

 

I added three values (A/P, A/R, Warehouse) (see below) but these values should obviously make sense to your business.  You can also add additional fields like this one to classify your saved search along other segments of your business.

 

 

Field 7: Record Type

  • Label: Record Type
  • ID: _ssd_record_type
  • Type: List/Record
  • List/Record: Record Type

This field should not be stored and should be sourced from the Saved Search (See below).

Okay, your custom record should have these fields:

 

Step 3: Add User Event Script on “Saved Search Details” custom record

Create a file from the code below and deploy this code to the “Save Search Details” custom record.   Reference my article “Quick Guide to Adding and Deploying a Script in NetSuite” if needed.

This code will set the value for the “Saved Search ID” field which is needed to create the link to edit and run the searches.

 

/**
*@NApiVersion 2.1
*@NScriptType UserEventScript
*/

define([],
() => {
        beforeSubmit = (context) => {
            if (context.type !== context.UserEventType.CREATE && context.type !== context.UserEventType.EDIT)
                return;

            const newRecord = context.newRecord;

            newRecord.setValue('custrecord_ssd_search_id', newRecord.getValue('custrecord_ssd_saved_search'));
        }
        return {
            beforeSubmit: beforeSubmit
        };
    });

Step 4: Create or Find a Saved Search which you would like to categorize

This article will assume you know how to create a saved search in NetSuite.  You must mark the saved search as Public or it will not be available for you to choose when creating the custom records.

 

Step 5: Create “Saved Search Details” custom records

From the custom record, hover over “More” then click “View Records”.

 

 

Click “New Saved Search Details:

 

You will see the “Owner” field is filled out with your name.  You can change this if needed.  This is a field you will be able to search on.

Select the Saved Search which you want to add.  Now add a description and group.  Click Save.

You will see the “Edit Search” and “Run Search” links are populated using the Saved Search ID.

 

 

Optionally, add some more “Saved Search Details” records.

Step 6: Create a saved search of “Saved Search Details” custom records

With the custom records created you can now create a saved search for specific “Saved Search Details” records you want to see.  For instance, you could search where the “Owner” is you, the group is “A/P” and the record type is “Transaction”.  When you see the results, you can easily edit or run the search as needed by clicking on the links.

On any “Saved Search Details” record click “Search”

 

Create your search and submit.  Click “Save This Search” to save.

 

Optionally add the search to your favorites to get to it easy.

Conclusion

I know in the past I have used spreadsheets to categorize saved searches.  With this customization that can be a thing of the past.  If you need help with customizing NetSuite, please click here to set up a consultation.

If you liked this article, please sign up for my newsletter to get these delivered to your inbox here.

Follow on
Jaime Requena Chief Executive Officer

Jaime Requena is a seasoned NetSuite Consultant and Solutions Architect, known for delivering WHITE GLOVE service to businesses. With 15+ years of experience and 3x certifications in ERP, Developer, and Admin, Jaime specializes in highly customized NetSuite accounts, transforming operations for 200+ satisfied customers all across the globe.

Get Connected

How can we help?


    Stay in the loop with Suite Tooth Consulting!

    We aim to bring unmatched expertise and professionalism to your NetSuite initiatives. Let’s talk about how our NetSuite consultancy can make a difference!

    Global Client Satisfaction

    Client Testimonials

    It’s Been 4+ Years Now And We Have Worked With Hundreds Of Clients, Building Our Way To The Top, One Happy Client After Another! Their Voices Of Satisfaction Serve As A Testament To Our Success –