Creating a saved search
The first step is to create a saved search that will provide the data that needs to appear in a field. Follow the below-mentioned steps to create a saved search:
- Navigate to List -> Search -> Saved Searches -> New.
- Click on Transaction.
- While creating the saved search, the following things need to be set:
-
- The public should be checked
-
- Since we are making this for sales order only, under the “Criteria” subtab, Filter “Type” would be set as “Sales Order”.
-
- Navigate to “Available Filters” subtab and set the filter as Internal ID
-
- Navigate to “Results” subtab. Click on “Remove All” button to remove the currently set Results, then add Item Rate in the results and set the summary type as “Sum”
-
- Give the Saved Search a relevant title (in this case, the title is Sum of Rates) and save it.
Creating Custom field
A custom field needs to be created to bind the Saved search to it and have it displayed on the form. Note that binding a custom saved search will only work on custom fields, not on a default NetSuite field.
- Navigate to Customization -> Lists, Records, & Fields -> Transaction Body Fields -> New.
Set the following values to the custom field:
-
- “Store Value” has to be unchecked
-
- The type of the result should match with the type of the custom field.
- Under the “Applies To” subtab, check “Sale”
-
- Navigate to the “Validation & Defaulting” subtab. From the Search dropdown, select the Saved Search created in the previous steps. In this case, the Saved Searches was created with the Sum of Rates title
-
- Give this custom field a label and save it.
Once all the above has been done. Navigate to any sales order, and under the “Custom” subtab, the “Sum of Rates” field will be visible, and it would be displaying the sum of rates of all the line items on order. Since Store Value was unchecked on the custom field, it will always try to set the default value provided to it, which in this case is coming from the saved search. Hence, making changes to the sales order would always reflect the impact properly in this custom field.