Create Line Action

05/01/2023 09:42 AM - By MavenCloud

The Create Line Action can be one of the most fun and dynamic actions you can perform in workflows.  Unfortunately, with workflows one of the greatest limitations is the ability to interact with sublist data.  In the 2018.2 release NetSuite added the ability to manipulate sublist data on transactions, but only for limited actions and only for the Items sublist.  While this became incredibly helpful to users, it left much to be desired because of other sublists (like the Expenses or Lines sublist) are not supported, other records with sublists are not supported and only a few actions are supported within sublists.  Even with these limitations, the ability to create and update sublist data using workflows was a huge step forward for SuiteFlow.

Because the Create Line action is limited to only the Items sublist you can only utilize this action when setting up a Transaction based workflow.  After selecting the record type NetSuite will validate what actions are applicable and the Create Line action won't even show up as an option for you if the record you choose does not contain the Items sublist.  Most likely, these limitations are because of the complexity of manipulating other sublists and the possible performance impact to those types of actions.  However, hopefully in future released NetSuite will choose to expand upon the sublist actions available today.

The Create Line action itself can be used to do exactly what the name suggests.  You can add a line to the current transaction within the Items sublist.  The parameters for this action give you the ability to decide the placement of the new line item.  (ie. Before the First line or After the Last line).  One of the most common examples of how you can use this action in your organization is to automate the addition of free items or supplemental items needed for your orders that commonly get forgotten.  For example, if an item you ship requires some specific hardware and you don't want to create a Kit for this combination you can use the Create Line action to add the hardware onto the Sales Order so your warehouse team remembers to ship both together.  Furthermore, if you offer incentives like free gifts, discounts or BOGO deals then you can automate the addition of these incentives so your sales team does not forget to add them in the proper context.

In this example we are going to give a free gift to our customer if their order total is over $100.  To setup the Create Line action there are just a few simple parameters to consider:


First open the workflow state that you want to add a new line to your transaction in and select New Action



In the Actions list select Create Line



In this context we need to use the After Record submit trigger as we need to validate the order total which is calculated as the record is being saved.  So we would want to let the transaction get saved and perform all native scripts, then reload the record, validate the Total Amount and add a line for a free gift if it meets the threshold.  The After Record submit trigger does exactly this.



For a condition we are going to use a Saved Search as the condition.  You could use the regular condition field and use the "Total" field to validate the order total.  However, we have a stipulation in this example that shipping is not included in the total amount being considered.  Therefore, we need to make a Saved Search that only validate the items on the order and NOT the shipping amount.
(Remember the trick here is that the Saved Search will not have the correct information for the current record until it is fully saved to the database, so that is why the After Record Submit action is critical for this to work)



One more thing to consider is the Event Type of this action.  In this example we would want to be aware of exactly WHEN the free gift should be added and when one should not be added.  For example, if we do not limit the Event Type here, then a new line will be added to the Sales Order every time it is edited and saved.  In some cases this could cause multiple free gifts to be added to our orders.  This is where you can use the Event Types to limit these sort of scenarios.  In this case we will set the Event Type to "Create" so a line is only added when the record is first created.  

(For more information about Workflow Triggers read our Blog post on Triggers, Contexts and Event Types.)



Now in the Parameters section lets begin by selecting the Sublist and Line Position.  Fortunately there is only one option for the sublist and 2 simple options for the line position.  In this example we will choose to place the new line at the end of the Items sublist.



One really nice feature of this action is you have full control of all the fields you would like set on the line item.  Add as many fields as you like into the Fields list and all those transaction line fields will be set when the new line is created.  For example, if you want to assign this free gift offer to a unique department or class you can do so.  Also if you have any custom transaction line fields that you need to set, you can do that here as well.  Lastly, remember to set a value for any mandatory line fields.  (ie. the Item, Quantity and Rate/amount fields are always mandatory on transactions.)

Now with this action added to our workflow the Criteria of the saved search will be evaluated every time a sales order is created and add the Free Gift if the transactions is one of the results of our saved search.

We have seen this action used in many different contexts and applications, but if you consider all the options and capabilities that this opens up you can quickly see how powerful this action can become.  Not only can it help your sales team so they don't have to remember what incentives apply to what orders, but it can also help your warehouse team.  Kit/Package Items in NetSuite can be notoriously difficult to work with and manage for many reasons. 

Many NetSuite customers express frustration with Kit/Package Items.  They provide a much needed function, in that they give you the ability to have your warehouse pick and ship multiple items together, without having to provide some sort of value add process through a work order.  This ensures that you can kit together items for shipment during the picking process but you don't need to overload your COGS with unnecessary labor costs from a work order or assembly build.

Some of the issues with Kits are that you cannot easily see what components are missing from the Kit directly from the Sales Order itself.  Only, that the entire line item does not have enough components to make up the required number of Kits.  Furthermore, Kit availability is difficult to manage and report on, especially when you have multi-location inventory enabled.  Kit/Package Items are also difficult to calculate a true Gross Profit number for as the Item Fulfillment lists each component individually (driving COGS), but the Sales Order/Invoice only lists the overall Kit parent item for the Revenue impact.

In these situations this causes companies to start looking for other options to make sure the correct items are shipped to their customers.  As a workaround to Kitting items you can use this Create Line action to add items automatically to orders in certain contexts.  Like retail goods that require a display unit, or marketing display.  Or industrial equipment that requires certain hardware or bracketry for installation.  These scenarios represent areas where Kit/Package Items and Assembly Items fall short as we don't want to setup a new Kit for each combination of item/hardware AND we do not want to add manufacturing labor to the process just to make sure the customer has the correct hardware to install their product.


Be sure to let us know how you have used the Create Line action in your organization and also check back with our blog as we continue to work through each action in detail for our Workflows for Beginners series.

MavenCloud