NetSuite customization isn’t always limited to what developers can do with scripts. Some of the best and cleanest customizations can be done by anyone in the user interface. Today, we’ll show you how to populate the value of a custom field through a Saved Search!

Create a Unique Saved Search

The first step is to create a Saved Search. It’s important to note that the custom field will only support sourcing from a Saved Search for a single value. This means we can display the number of open Sales Orders for a customer, but we cannot display a dropdown selection of options in the field, for instance.

Let’s create a Saved Search that shows the number of open Sales Orders for a customer. Our custom field will then source from this search and filter the results to the customer on the current record.

To create a search, go to Lists > Search > Saved Searches > New in the NetSuite menu.

In the list of search types, find the appropriate option (in our case, the “Transaction” option since a Sales Order is a type of transaction).

Now you should see the Saved Search setup page. For our new Saved Search, be sure to create an appropriate name and internal ID. You may want to put “(Do Not Delete)” at the end of your Search title so it never gets deleted accidentally.

You will also want to check the “Public” checkbox so that the field sourcing will work great for everyone on your team.

Set Filters

Without specifying any filters, we would see every transaction in the system, including Purchase Orders, Invoices, and more. This isn’t quite what we want. So to filter down our results to open Sales Orders, we can add three filters: (1) Type is “Sales Order,” (2) Mainline is false (so we don’t see a separate search result for each item on the Sales Order), and (3) Status is none of “Closed,” “Cancelled,” or “Billed” (only show SOs that are still open).

Set Result

Next we need to specify the final result. This is what will display in the custom field. As mentioned previously, this can only be one piece of data. In our case, we simply want to see the number of open Sales Orders. Setting a Summary Type to “Count” will count up the total number of a given result. Since each Sales Order only has one internal ID, this would be good way to count how many Sales Orders we have.

Set Available Filter

Setting the Available Filter is how we will filter the custom field to the customer on the current record for the custom field. So here, we put “Name” (i.e., the customer) as our available filter. If you are ever confused about which option to choose in the list, you can reference the official Record Browser here to match the field name with the search option title.

Now, the custom field should further filter down the results to only the ones where the customer matches the customer on the record you are viewing.

Create a Custom Field

To finish our customization, we need to create a custom field. Navigate to Customization > Lists, Records, and Fields > Transaction Body Fields > New in the NetSuite menu.

As with the Saved Search, we want to set a suitable title and ID. Also be sure to uncheck the “Store Value” checkbox. Because the field will source from the results of the Saved Search, we don’t want it to try to store that value permanently in the field itself.

Select the type of transaction you want the field to apply to (in our case, we’ll set it to “Sales” so that it will appear on a Sales Order).

Next, all we need to do is set the field to source from our Saved Search. In the Validation & Defaulting tab, set your search in the “Search” dropdown field. Also, in our case, we will need to set the “Field” dropdown to “Customer” to connect to the Available Filter we set on the Saved Search. Once you save, you should be good to go!

You can view your field on any Sales Order. It will likely appear under the “Custom” tab. If you would like to rearrange where the field appears, stay tuned for a future blog post where we explain how to do this in detail.

Conclusion

Custom fields and Saved Searches are both powerful tools in their own rights. But when we combine them, powerful automations can be created. Leave a comment below if you found this tutorial helpful!