How to Use Saved Search to Set Field Values in NetSuite
The process outline below offers a great opportunity for businesses to use a saved search to set field values, without having to utilize scripting. Clients can utilize this process as with the example below to pull in the total applied credit memo’s for a customer and/or project. In today’s work force being able to source the data needed real time into one place offers greater efficiencies. The process described below offers opportunities for the business to source reporting/analytical data to records real time on edit and or view, without having to look in multiple places.
This specific scenario will allow users to source any and all credits that have been applied to a specific invoice. This allows for real time sourcing without scripting. Saved Searches can be used to dynamically populate fields on any record if setup properly. This is accomplished by setting the saved search to only return one result column. This can be done by adding a specified filter as well as setting a field to source the value from the field definition. In this use case we will be dynamically setting a transaction field using a saved search to show credit memos applied to an invoice.
Pros: This is a huge advantage when you need to dynamically populate a field, but don’t want to go through the hassle of writing a script.
Cons: This cannot be used in a saved search as the result is not readily available and is only calculated when you are viewing or editing the record.
Creating Saved Search
- Let’s start by creating a saved search.
- Navigate to Lists > Search > Saved Searches > New
- Select a Transaction Saved Search
- Create a Name for your Saved Search (Remember this for later)
- Check the Public Checkbox and Add Search Criteria
- In our example we use the following Criteria
- Type is Credit Memo
- Applied to Transaction: Type is Invoice
- Add Search Results
- In our example we use the following Results
- Applied To Link Amount (Foreign Currency) with a Summary Type of SUM (This sums the total of the resulted credit memos)
- Now we need to add Available Filters (Don’t Skip this Step!)
- In our example we will add the following Filter:
- Applied to Transaction (Check the Show in Filter Region checkbox)
- Available Filters work differently when applied to a custom field. When a field is set to source its value from a saved search with an available filter, it will automatically populate that filter with the filter option. In this case when used for our custom field the search will automatically set the “Applied to Transaction” filter with the current applied to transaction.
- Save the Saved Search
Creating Custom Transaction Field
- Next, add a custom transaction field to hold the value from the search.
- Navigate to Customization > Lists, Records, & Fields > Transaction Body Fields > New
- Create a Name for the Field, a description (Optional), and a Type.
- In our example we will set this to “Currency”
- Important: Make sure to Uncheck the “Store Value” Checkbox to allow the field to be dynamically set.
- Apply the field to a Transaction Type
- In our example we will check the “Sale” checkbox to apply it to Invoice.
- Finally, in the Validation & Defaulting subtab select the saved search you created from the “Search” field.
- Click “Save”.
Now simply navigate to any invoice record with a Credit Memo applied. There you can see the value of the sum of all credit memos applied to that invoice record. This is a great way for users to capture necessary data elements in one place.