Closely related to the Client Script is the User Event Script. The events of this Script type are again fired when a record is being loaded or saved, but it instead runs on the server side. As such, it cannot be used to respond immediately to field changes, but it also is not limited to only users interacting with the record on a form.
User Event scripts will execute no matter where the load or submit request is coming from, whether it's a user working in the UI, a third-party integration, or another internal Script making the request.
Whenever a process or user attempts to read a record out of the database, the User Event's
beforeLoad event is triggered. We can use this to pre-process data, set default values, or manipulate the UI form before the user sees it.
Once a process or user attempts to submit a record to the database, whether it's the creation of a new record, editing of an existing record, or the deletion of a record, the following sequence occurs:
beforeSubmitevent fires. We can use this event, for example, to clean up the record before it gets in the database.
afterSubmitevent fires. We can use this event, for example, to send out email notifications of changes, or to sync up with integrated third-party systems.
You can also watch this series of videos that help to visualize the events of this script type.