NetSuite recently added the ability to set sublist values via workflow, for the Items sublist. Prior to this new feature, the only way to manipulate data at the line level was via SuiteScripting. This resulted in many small scripts being written, meaning that NetSuite users had to find someone with the knowledge to do so. This investment in such a high-demand and high-cost skillset feels like unnecessary overkill, accompanied by a common lament: “if only NetSuite allowed us to apply workflow to sublist fields”. Thank goodness, the wait is over.
Or, at least, it largely is — there are still limitations to this feature. It currently can only be used in a before load, before submit or after submit event context. An example of this would include client-side events, such as changing a sublist field to a specific value while editing an order, after a different field is changed. Further, only the Item sublist is supported right now – so using workflows to set values for an Expense sublist on a PO, or on any other sublist, will not work.
Let’s walk through the steps to create a workflow that will set the Location column on the Sales Order Item sublist to be the same as the main (body/header-level) Location field. While not the most interesting example, it will demonstrate the basics.
Create the Workflow
To start, the workflow will be set up like any other. Using a role with the Classic center (like Administrator), go to Customization -> Workflow -> Workflows -> New.
Set your workflow Name, ID, Record Type, Sub Types, and other fields as below:
Mark the workflow to run On Create, and On View or Update. Leave all the other fields as default for the purposes of the demo.
This will allow the workflow to run any time the sales order is saved. In practice, it might be useful to limit a workflow like this to only run On Create, if that is all that is needed – this will cut down on unnecessary workflow processing that could slow down the editing of Sales Orders for your users.
Click Save to create the workflow.
Adding the Sublist Action Group
The key to leveraging sublist actions is creating a sublist action group. Without this group, you cannot create any actions that affect sublists.
Double-click on your initial state to edit it (or click once, and click the pencil icon). Then, click the button labeled “New Sublist Group”:
The screen that pops up looks similar to any other Action or Action Group pop up. Here, you can define the trigger, event types, contexts, and conditions that should apply to the group.
In the Parameters section, you’ll notice the unique Sublist field, which is mandatory. As mentioned above, the Items sublist is the only one that is available for now.
For our example, we will set the Trigger type to After Record Submit, and click Save.
Adding the Sublist Action
Upon saving your Sublist Action Group, you’ll be returned to the Workflow State pop up. From here, you can click on the group you just created to bring it back up.
This time, you’ll notice a sublist at the bottom, including a button labeled “New Action”.
Clicking this button will bring up the New Action screen you are familiar with, if you’ve created workflows before. You’ll notice that the list of action types is much smaller than the standard set. These are the only action types that can be triggered based on a sublist action.
For our example, we will choose the Set Field Value action.
In the Workflow Action pop up, we’ll set the Field we wish to set, and the value we want to set it to. We can also add any line-level conditions we may have.
For the example, we want to choose the line-level Location field. Line level fields are denoted by having “(Line)” in parentheses.
For the value, we want to select the main Location field. This will ensure that the line-level Location always matches the main Location value.
Once done, click Save.
Your State pop up should refresh and look like this:
At this point, we can test our workflow to see it in action.
Testing the Workflow
To test the workflow, create a new sales order, with a main location that differs from the item’s line level location, like so:
After saving, the workflow will update the location on the line to match the main location value:
As you can see, what you can do with sublists in workflows is limited. However, for the use cases to which it can apply, it can provide a quick and easy solution, without the need to use SuiteScripts.
What are some use cases you’ve come up with to leverage sublist workflows? Leave your stories in the comments below!
For more information on this topic or others related to NetSuite, contact RSM at email@example.com or by phone at 855.437.7202.
By: Alex Placito