Use Case

I need to evaluate records after their assignment rules have been updated, workflows do not meet this requirement because I need complex apex logic after the record has met the condition.

I believe process builders are also not possible as they are executed before assignment rules.


Assuming the above is correct, I plan on publishing a platform event after commit in a trigger. The platform event would then invoke a process builder to then invoke the apex, but I am unsure as to when a platform event is published when invoked from a trigger.

Given order of execution is:

  • Before Flows
  • Before Triggers
  • Validation Rules
  • Duplicate Rules
  • After Triggers
  • Assignment Rules
  • Auto-Response Rules
  • Workflow Rules
  • If updated via workflow field updates, update and after update triggers ran again.

If I use a publish after commit platform event, will the event be published after the first after triggers or after the workflow rules / second round of after triggers?

The documentation states that after the duplicates rules, but before the first after triggers:

Saves the record to the database, but doesn't commit yet.

I would assume this means the platform even would wait until the last round of workflow rules/after triggers to be published, but it's not clear.

1 Answer 1


Process Builder runs after assignment rules. If you need complex logic, you could set up a Process Builder that calls an InvocableMethod (Apex) that can then perform your complicated evaluation logic. You can also build this as a Flow triggered from Process Builder. There's no need to go asynchronous with this unless you're already bumping up against governor limits.

  • Thanks. In the order of execution, process builder is not explicitly listed, does it fall under the "workflow rules" step?
    – S.B.
    Sep 9, 2020 at 17:27
  • 2
    @S.B. It's step 14, immediately after workflow rules. Process Builder is the builder, the thing that runs is the "process."
    – sfdcfox
    Sep 9, 2020 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.