Execution Order of Scripts
User-specified scripts in M-Files are executed in a specific order and the point in which they are executed depends on the event for which the script is written. See the lists below for the order in which events are by default executed when a user performs a certain action in a vault. Note that the exact order and number of events that are triggered after a specific user action depend on the vault structure and the types of scripts used in the vault.
The user creates an object and immediately checks it in:
- Property value validation
- Calculating automatic property values
- The BeforeCreateNewObjectFinalize event
- Workflow state preconditions
- Workflow state actions
- The AfterCreateNewObjectFinalize event
- The AfterCheckInChangesFinalize event
The user creates an object, then modifies its property values, and after that checks the object in:
- Property value validation
- Calculating automatic property values
- The BeforeCreateNewObjectFinalize event
- The AfterCreateNewObjectFinalize event
- The BeforeSetProperties event
- Property value validation
- Calculating automatic property values
- The AfterSetProperties event
- The BeforeFileUpload event
- The AfterFileUpload event
- The BeforeSetProperties event
- Calculating automatic property values
- The AfterSetProperties event
- The BeforeCheckInChanges event
- Workflow state preconditions
- Workflow state actions
- The BeforeCheckinChangesFinalize event
- The AfterCheckInChanges event
- The AfterCheckInChangesFinalize event
The user modifies the property values and changes the workflow state of an object:
- The BeforeCheckOut event
- The AfterCheckOut event
- The BeforeSetProperties event
- Property value validation
- Calculating automatic property values
- The AfterSetProperties event
- The BeforeCheckInChanges event
- Previous workflow state postconditions
- New workflow state preconditions
- Workflow state actions
- The BeforeCheckinChangesFinalize event
- The AfterCheckInChanges event
- The AfterCheckInChangesFinalize event
- The BeforeReturnView event
If you have more than one event handler of the same type, you may change their execution order by selecting the event handler in the Event Handlers dialog and clicking either the up or down arrow button along the right side of the dialog: