I have an object for which there is already an Apex triggerhandler that deals with multiple conditions for 5 different recordtypes. This is working fine.

There are also currently 2 Process Builders that deal with different needs. I am looking to replace these with a Flow. Best practice suggests one Flow to handle things (both the PBs are after update conditions), but I'm struggling to understand how to best achieve this, as I'm not quite up to scratch with Flows yet. I've made an attempt, but I don't think it's quite right because the 2 scheduled legs seem to not work as I had hoped.

enter image description here

The Start occurs on the custom object Certification, when a record is created or updated. I have no conditions set here because of the 'one flow for everything' (as in all after update actions), and I think that is why the scheduled legs don't work as I'd hoped.

In each of the 2 scheduled legs I have the conditions set in the update action only

  • the far right hand one is supposed to create a time-based update to the record being updated only if it's a specific recordtype with a specific Status 7 days after creation. It is currently running this for every record, as it seems to only check the conditions for update once the 7 days have passed - this is not what I want. I want it to only create a time-based update if the record meets the conditions
  • the 2nd from right is also time-based, based on a date field in the record to update on that date (so 0 days after the given date), and has 4 conditions as to whether the record should be updated or not. It doesn't currently create this one (when I look at the time-based workflows).

The Run Immediately leg is for every updated record, and the condition checks the recordtype and does the actions for whichever one it is in sending an email based on certain conditions in the recordtype specific leg. This is working.

It would be easy if I set the condition at the Start, but then it limits the flow to that condition only, so I would then end up with 3 flows.

So my question is what is best here?

  • put everything in the Apex triggerhandler and create scheduled jobs for the time-based updates (we have lots of scheduled jobs already)
  • create 3 after update flows to handle the
    • immediate 'send email' if its conditions are met
    • time-based flow with the date check condition to update on that date
    • time-based flow on creation of a new record to update Status 7 days after creation
  • fix the one flow as shown to make it work properly for all 3 options above and to ignore the time-based legs if those conditions aren't met. How would I do this? Do I create decisions before both of them?

Although I've read that Salesforce recommends not creating multiple Flows for 1 object (other than before/update/delete separation), the Trailhead example here has multiples with a condition at each Start, and using the Flow Trigger Explorer to order them. So what is the right thing to do?? https://trailhead.salesforce.com/content/learn/modules/record-triggered-flows/meet-flow-trigger-explorer


Your Answer

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