Workflow Triggers
Triggers are based on events that occur during the processing of a record in NetSuite and dictate when the workflow should perform certain tasks. NetSuite defines triggers for when a workflow should initiate, when actions should be performed, or when a record should transition to another state for the record, based on the processing of a record in NetSuite. You direct a workflow to respond to the record-processing events.
SuiteFlow includes two types of triggers, server triggers and client triggers:
The type of trigger you use in SuiteFlow depends on when you want a workflow to either initiate or complete a specific action or transition. For example, if you want to alert users to change a field before submitting, use a client trigger. If you want to notify them after submitting, use a server trigger. You can only start workflows on server triggers.
Limiting the actions a workflow does can make it easier to manage. Picking the right trigger also helps workflows run better and reduces the chance of missing info. This is especially important for workflows that use client triggers, since they involve user interaction.
You can initiate a workflow or transition to another state on any of the server triggers or set up actions to execute on the server and client triggers. The triggers supported for actions depend on the type of action. To understand the order in which triggers execute for actions or transitions in a workflow state, see the SuiteFlow Trigger Execution Model.
Server Triggers
Server triggers occur when a record is read from or written to the NetSuite database or when a record enters or exits a state in a workflow. Server triggers are classified as either record based, workflow based, or time based.
-
Record based triggers occur when something happens to the record:
-
The record is going to load (Before Record Load trigger)
-
After the record loads, but before it is saved (Before Record Submit trigger)
-
The record is saved (After Record Submit trigger)
-
-
Workflow based triggers occur when something happens to the workflow
-
A state is entered (On Entry trigger)
-
A stated is exited (On Exit trigger)
-
-
Time based triggers happen on a schedule you set (Scheduled trigger)
Workflows evaluate and execute all actions in a state for a specific server trigger before they evaluate and execute the transitions for that trigger.
The following table describes the server triggers and the type of workflow tasks to which they apply:
Trigger Name |
Applies To |
Description |
---|---|---|
Before Record Load |
|
Triggers when a new record is created, before it's loaded into the browser, or before an existing record loads into the browser.
Use this trigger when setting default values on fields for the record form, hiding fields on the record form, or locking a record. |
Before Record Submit |
|
Occurs after a user clicks Save on a record and before NetSuite saves the record data to the database.
Use this trigger when validating record form fields or calculating field values before saving a record. |
After Record Submit |
|
Occurs after NetSuite saves the record data to the database.
Use this trigger when sending an email that a record has been changed or when creating dependent records. |
Scheduled |
|
You can create a schedule for workflows to initiate, and for actions and transitions to execute. |
Entry |
|
Occurs the first time that a workflow enters a state at the same time as the first server trigger*.
*On Entry triggers don't execute on their own. They execute at the same time as the first ordered server trigger for a state. For example, the On Entry trigger executes when the workflow enters a state simultaneously with the Before Record Load trigger. |
Exit |
|
Occurs when a workflow exits a state and transitions to another state. |
ALL |
|
For workflow initiation only. The workflow initiates on any triggering event. |
The Scheduled trigger is considered a server trigger. However, scheduled actions and transitions are not directly associated with user events such as loading or saving a record. Scheduled actions and transitions are automatically initiated by NetSuite, based on user-defined time increments. For more information, see Scheduled Trigger and Initiating a Workflow on a Schedule.
Client Triggers
Client triggers execute when a user interacts with a record form in NetSuite. You can view the client triggers used for actions for a specific workflow state under Form Event on the State subtab of the context panel.
The following table describes the client triggers:
Trigger Name |
Description |
---|---|
Before User Edit |
Executes when the record form loads into the browser. Use this trigger to make changes to the record form in the browser before the user edits any field. |
Before Field Edit |
Executes when user tabs or clicks away from a field after entering a value. Use this trigger when validating the value of a record field. |
After Field Edit |
Executes when a user enters or changes the value of a field. Use this trigger when dynamically updating the values of other fields when a user changes the value of a specific field. |
After Field Sourcing |
Executes after a field change, after all of the child field values for the field are sourced. Use this trigger when setting field values based on other sourced values. |
Before User Submit |
Executes every time a user clicks Save when the form is in the state. The actions execute in the browser, before any data is sent to the NetSuite database and the save operation occurs. Use this trigger when validating record form field values. |
More Information About Server and Client Triggers
Use the following table to get more information about working with server and client triggers:
Task |
For more information |
---|---|
Understanding the SuiteFlow trigger execution model |
|
Get a description of each trigger type, including examples |
|
View which triggers did or didn't execute |
|
Using triggers for workflow initiation |
|
Using triggers for actions |
|
Using triggers for transitions |