• Trigger Execution Process in Salesforce| Order Of Trigger Execution

    Published By: Venu Gutta
    Published on: Thursday 9 February 2017
    A- A+

    1) Loads the  record from the database or initializes the record for an upsert statement.
    2) Loads the new record field values from the request and overwrites the old values with new values.

    If the request came from a standard User Interface edit page,  runs system validation to check the record for:
      -Checks whether Required values is present or not at the page layout level and field-definition level
      -checks field formats are valid or not (example:  Email ID format, Phone number format)
    3) All before triggers execution.
    4) Runs most system validation steps again, such as verifying that all required fields have a non-null value, and then runs any custom validation rules. The only system validation that Salesforce doesn’t run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
    5) Saves the record to the database, but doesn’t commit yet to Database.
    6) all after triggers Executed.

    7) Run assignment rules and auto-response rules.
    8) workflow rules Executed.
    9) If there is any workflow field update, updates the record again.
    10) If the record  updated with workflow field update, fires before and after triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.
    11) escalation rules executed.
    12) If the record contains a roll-up summary field, rollup summary fields are calculated and updated.
    13) Run Criteria Based Sharing evaluation.
    14) Commits all DML operations to the database.
    15) Run post-commit logic, such as sending email.