7

I have some very simple automation in place for demoing Salesforce "Order of Execution". I have a field on called Version__c which increments by 1 in a trigger and a workflow. This is what happens:

  1. Before update trigger fires, Version__c increases to 1
  2. Workflow w/ field update fires, Version__c increases to 2
  3. Before update trigger fires again, Version__c increases to 3

I'm hoping to add more even more automation to this (process builder) and have our team easily track these types of changes when something unexpected in our org occurs.

The best visualization tool that I could come up with was in the Developer Console.

Debug > Perspective Manager > change to All (Predefined) > Click Save Order or Timeline tab

Are there any other tips/tricks that I could share to our non technical team members to help investigate these types of scenarios? I'll be honest, I even find Salesforce's developer console a bit verbose and intimidating at times...

Perspective Manager - All

****Update - I added a process builder (with Recursion unchecked), which increments the Version even more.****

My debug in the trigger appears hit 3 times in the logs. But the output is now 5? Now I'm even confused as to what is happening behind the scenes...

  1. Process Builder runs, updates the Version__c to 4?
  2. Trigger runs again, updates the Version__c to 5?

image2

6
  • 2
    personally, i try, where possible, to avoid WFR and PB to do field updates on the triggering object if I've already invested in apex code for triggers on that object. One can avoid trigger recursion issues and trigger.old considerations
    – cropredy
    Mar 5, 2018 at 19:12
  • 2
    100% agree with this... It's confusing as hell, but I mainly want us to be able to debug previous configuration.
    – rmarq423
    Mar 5, 2018 at 19:26
  • 1
    5 is expected right? Before update is fired three times(manual update, WF field update, Process builder update) and workflow and process builder.
    – javanoob
    Mar 5, 2018 at 19:51
  • 1
    I would have expected 5 or 6: Trigger (1), Workflow (2), Trigger (3), Process Builder (4), Trigger (5), Workflow (6) [appears to fire in the screenshot?]
    – rmarq423
    Mar 5, 2018 at 19:58
  • 2
    see jitendrazaa.com/blog/salesforce/…
    – cropredy
    Mar 5, 2018 at 20:06

1 Answer 1

2

After researching this extensively I didn't find any other good tools for determining the order of how these fire. What really is unfortunate is how unreliable this really is for the following reasons:

  • Process builder is not at all mentioned in any of the Execution tabs: 'Save Order', 'Timeline', 'Executed Units' etc. (only reference to process builder I could find was in the debug log itself: "14:10:18.0 (47496796)|WF_ACTION| Field Update: 2; Flow Trigger: 1;")
  • Before Triggers show up 6 times in the above screenshot, however only run 3 times (verified in debug logs)
  • Clicking into each of these triggers shows no details and displays the following message "No Batch, Schedule or DML actions"

finalscreenshot

For what it's worth here is the output and how many times each automation metadata type runs (in their respective order):

workflow and trigger (2): Trigger Ran; Workflow Ran; Trigger Ran;

workflow and process builder (2): Workflow Ran; Process Builder Ran;

trigger and process builder (3): Trigger Ran; Process Builder Ran; Trigger Ran;

all three (5): Trigger Ran; Workflow Ran; Trigger Ran; Process Builder Ran; Trigger Ran;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .