SuiteScript 2.x User Event Script Reference
User event scripts are executed based on beforeLoad, beforeSubmit, and afterSubmit operations. For more information about how user event scripts are executed for each operation, see How User Event Scripts are Executed.
To learn how to write a basic user event script, see SuiteScript 2.x User Event Script Tutorial. In this tutorial, you will create a script that creates a new employee record, manipulates fields on the record, and creates a task.
Also see the User Event Script Best Practices section in the SuiteScript Developer Guide for a list of best practices to follow when using client scripts.