NetSuite User Event scripts are one of the most common script types used in NetSuite. User Event scripts make it easy to automate actions when a record is loaded or saved, and creating a simple User Event script could save a lot of time. In this article I am including some basic information around understanding User Event scripts.

Triggers

Understanding when a script is triggered is critical for creating a script that performs according to your expectations. User Event scripts have three triggers – Before Load, Before Submit, and After Submit.

  • Before Load: This is the moment a record loads when it is being created, edited, or viewed. This trigger is great for automatically populating fields with default values when creating a record – great for saving time on manual entry.
  • Before Submit: This triggers the script at the moment a user clicks the save or submit button on a record and before the changes are submitted to the database.
  • After Submit: This also happens when a user clicks save or submit, but it runs the script after the changes are submitted to the database.

Many User Event scripts that need to run when a record is submitted could use either Before Submit or After Submit. I tend to use the After Submit trigger unless I need to automate additional changes on the record before it gets submitted to the database.

Example Uses

  1. Automate field values when creating a record.
  2. Create a task record when a purchase order is submitted.
  3. Send an email notification
  4. Change the status of a record when certain things are true.

If you have any questions about what a User Event script can or cannot do, I would love to hear from you!