The Problem
Anyone who’s ever created a NetSuite Workflow has probably encountered a scenario where you need to use a Saved Search to trigger a workflow action or initiate a workflow, and this works very well. At times, the business logic may require you to look at a summary result of the search (for example: counting records, looking for a summed value, etc.), this is where you’d notice that NetSuite doesn’t respond as expected because it looks at the full result of your search and not the summarized view that one would see through the user interface. So how does one overcome this by still using the summarized results of your single search?
The Fix
First, we need to create a Summarized Save Search in the system to display the result or variable that you wish to monitor to determine if the workflow should take any action. Here are some quick points about this Save Search:
- Add search criteria to filter out any records/lines you do not want to be included in the rollup value
- Define a search results field for which values will be rolled up, and select a summary type (Count, Sum, Minimum, Maximum, and Average are supported; Group summary type is not supported). For example, you could set Quantity as the results field and set a summary type of Sum
- Define an available filter field. The field is used to filter search results to include only those records with available filter field values that match the available filter field value of the current record. The value displayed for the summary search custom field is a rollup of search results field values for the records that have matching available filter field values
Second, create a custom field that matches the save search record type (for example: if your summary search is a customer search, you’ll need to create a custom entity field). Set up your field as a Free-Form Text, uncheck “Store Value”, and under the “Validation & Defaulting” tab select your summary search in the search dropdown. The key here is to not store the value, NetSuite will execute and provide the workflow with the latest information to trigger the workflow.
Also, make the field display ‘inline’ so the value does not get tampered with.
Now you have a triggering mechanism for your workflow to use for your workflow action. In my example, I have a customer workflow that checks to see if there are a specific number of open opportunities for that customer and if it reaches the threshold it will display a button that would lead to another record being created.
So depending on your specific outcome, there’s hope if you need to look at a summary data set to make your workflow automation perform its duty, without the need for custom scripting. This also gives you greater control over the thresholds, as the save search just needs to be updated or adjustments made to your workflow through the user interface.
Want to learn more? Reach out to our NetSuite experts today!