2

Situation

  • In order to reduce the number of triggers and custom code processes are very helpful. From my point of view there is no defined order in which processes are executed.

Question

  • In which order are processes executed?
  • How many dml statements are used per execution context?

Example

  • A given field is called count. The current value is 1.
  • There is a process which adds 2 to the field in case the value of my field is even.
  • There is a second process which adds 1 to the field in case the value of my field is odd.
  • There is a third process which executes apex. The apex class adds 10 to the field.

  • My record is updated twice.

What is the value of the field count?

  • Is this an actual issue you are facing or are you just posing a hypothetical? – Chris Duncombe Oct 8 '15 at 12:06
  • @ChrisDuncombe This is a real issue. The example is just simplified to generalize the question. – Christian Deckert Oct 8 '15 at 12:07
  • What triggers the Apex? Just a change in that particular field? – Chris Duncombe Oct 8 '15 at 12:09
  • The apex is always triggered. (let's say NOT(ISNULL(ID)) – Christian Deckert Oct 8 '15 at 12:10
  • Hmmmmm.....very odd. Can you see in the debug logs which 2 of the 3 are updates are executing and which one is not executing? – Chris Duncombe Oct 8 '15 at 12:13
1

This is one of the areas where Process Builder falls squarely on its face. Ideally, your process would have a decision tree that allows it to determine whether the count is odd or even and then add 1 if it's odd or 2 if it's even - all as part of ONE single process, NOT as two separate processes! After doing that, the Apex class would then be called.

The way to do this at one time was using "Flow Triggers", which are no longer available except in orgs that were already using them. As an FYI to those who aren't familiar with them, they're Flows which don't require a Visualforce page to appear in order to for them to run; allowing them to operate like a trigger (see the Power of Flows webinar series for more).

This kind of logic is available to you in a Flow, but at present, not in process builder. That said, I'm aware of a 3rd party app called Breeze 3.0 that will allow you to do this with workflow or Process Builder, including pre and post processing steps. Unfortunately, it's an expensive App, but if you really need it, you may not have any choice unless you want to build the logic into a trigger of your own design.

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.