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:

  1. Property value validation
  2. Calculating automatic property values
  3. The BeforeCreateNewObjectFinalize event
  4. Workflow state preconditions
  5. Workflow state actions
  6. The AfterCreateNewObjectFinalize event
  7. The AfterCheckInChangesFinalize event

The user creates an object, then modifies its property values, and after that checks the object in:

  1. Property value validation
  2. Calculating automatic property values
  3. The BeforeCreateNewObjectFinalize event
  4. The AfterCreateNewObjectFinalize event
  5. The BeforeSetProperties event
  6. Property value validation
  7. Calculating automatic property values
  8. The AfterSetProperties event
  9. The BeforeFileUpload event
  10. The AfterFileUpload event
  11. The BeforeSetProperties event
  12. Calculating automatic property values
  13. The AfterSetProperties event
  14. The BeforeCheckInChanges event
  15. Workflow state preconditions
  16. Workflow state actions
  17. The BeforeCheckinChangesFinalize event
  18. The AfterCheckInChanges event
  19. The AfterCheckInChangesFinalize event

The user modifies the property values and changes the workflow state of an object:

  1. The BeforeCheckOut event
  2. The AfterCheckOut event
  3. The BeforeSetProperties event
  4. Property value validation
  5. Calculating automatic property values
  6. The AfterSetProperties event
  7. The BeforeCheckInChanges event
  8. Previous workflow state postconditions
  9. New workflow state preconditions
  10. Workflow state actions
  11. The BeforeCheckinChangesFinalize event
  12. The AfterCheckInChanges event
  13. The AfterCheckInChangesFinalize event
  14. 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: