This article is relevant if you are developing automation on NetSuite drop ship and special orders.
Background
Our NetSuite Systems Integration Practice is a specialist in NetSuite Platform automation and enhancement. Not only do we enhance the platform, but our background in accounting and business operations also helps us think in a more fundamental manner about the way NetSuite offers its processing flows.
For example, the way that NetSuite has implemented the drop ship function limits our clients’ ability to properly measure gross margin and profit (please reference this 2018 article). However, through the use of inventory items and special orders, we can properly solve the gross margin challenge — but this causes a great deal of record management for traditional drop ship flows. Hence, in 2016, we created full automation of this enhanced practice which we call NetSuite Drop Ship Accruals.
The automation we created works with the generation of NetSuite Purchase Orders. We must work with NetSuite’s automatically generated linked Purchase Orders from Sales Orders once they move to the Pending Fulfillment (approved) state. Since we are working in the automation area, we need to work with record UserEvents to implement our special capacities.
UserEvents Do Not Execute on NetSuite Drop Ship or Special Order
For those that are producing automation on NetSuite records, they may be frustrated to learn that NetSuite will not fire some UserEvents on the Sales Order automatic generation of linked Drop Shop or Special Order Purchase Orders. Our testing has revealed the following:
- beforeLoad: will NOT fire events
- beforeSubmit: will NOT fire events
- afterSubmit: WILL fire events
It is important to understand this because special custom logic in the beforeLoad and beforeSubmit events may need to be moved to the afterSubmit event. Note, in general, we attempt to avoid afterSubmit events because they are slow and expensive because we may need to reload the record and then commit any new changes — increasing wait time for business users.
Getting More Information About The UserEvent
A couple of seniors in our practice, (thank you Sean G. and Boban D.) revealed that there is more information available to us in our NetSuite SuiteScript logic. During the UserEvent, you will be passed a single parameter: the “context” object. One of the attributes is “type” and it comes from the enumeration context.UserEventType. Here is how you might use it.
We are generally accustomed to this test function to distinguish a Create vs. an Update event.
if (context.type == context.UserEventType.CREATE){}
But you now can also do the following to reveal the sub-function of Drop Ship or Special Order:
if (context.type == context.UserEventType.CREATE || context.type == context.UserEventType.DROPSHIP || context.type == context.UserEventType.SPECIALORDER){}
With this extra information, you can further refine your logic tree.
Work With Strong NetSuite Professionals
Since working with the NetSuite platform in 2008, we continue to appreciate the extensibility capacity. It allows us to carefully listen to our clients’ requirements and add value by shaping logic to address their requests. Indeed, capacity is really only about the possibility. The real substance comes from the listening and requisite skill demanded to actually act. Our expertise is illustrated by all the NetSuite bundles we give to our clients free of license charge as a method to accelerate producing solutions.
Perhaps you are a NetSuite analyst that appreciates the platform but seeks to be connected to a high-performing team? Alternatively, you may be an organization that is ready to connect with NetSuite experts to get the Platform’s promised value? If this resonates with you, let’s have a conversation.
If you found this article relevant, feel free to sign up for notifications to new articles as I post them.
First, thanks for all of the great Netsuite info! I’ve been relying on your articles for years now.
I have a need to build a User Event script that fires on creation of Special Order POs only, afterSubmit. The purpose is to write the new document number to the shipattention field on the new PO. This is to alleviate headaches in Receiving.
Can you clarify if the context.type can simultaneously be both context.UserEventType.CREATE and context.UserEventType.SPECIALORDER? I’d think it would have to be one or the other, right? I’ve already built a very similar script that instead targets a specific Role and execution context. I’m a bit stuck on targeting all Special Order POs.
Hello Kevin,
The answer to your question is Yes! But here is what you need to know:
When NetSuite automatically creates the drop-ship or special order, the beforeLoad and beforeSubmit functions on the Purchase Order do *NOT* execute. But the afterSubmit function *DOES* execute. (Thanks to both Sean and Boban, Senior Technical Consultants on our team for helping to clarify this)
You can write your code just like this in the afterSubmit event:
if (context.type == context.UserEventType.CREATE || context.type == context.UserEventType.DROPSHIP || context.type == context.UserEventType.SPECIALORDER)
Marty
Has your team tried firing UserEvent scripts with Special Work Orders as well? Even with afterSubmit, I’m not seeing any execution history & was hoping the Prolecto team may have run into this!
Hello Cory,
We use the Special Orders all the time. You reference Work Orders. These should fire normal events. Are you getting any events?
Marty