If I have a Record-triggered after-save Flow with Scheduled Paths, will those scheduled items be removed from the schedule if the Flow's version changes with altered entry criteria?
This question was triggered by an investigation about Process Builder Scheduled Action behavior after a version change as seen in these questions:
- Scheduled Processes in Previous Versions.
- Update Version of Process Builder and Pending Scheduled Actions.
Best stated in this Community post and this post
After speaking with Salesforce support we determined that it was process versioning that was causing the problem. For instance, if a case had scheduled actions and I activated a new process and then unmet the criteria, the scheduled actions operating off of the old version of the process do not recognize the new criteria and continue to fire the actions until the end of that criteria node.
Since Flow is the replacement for Process Builder, are Scheduled Paths afflicted with the same Process Builder versioning issue?
Best Answer
The short answer is NO; the new flow version's entry criteria gets applied to pending scheduled paths generated by prior flow versions
I did an experiment:
Is_FieldA__c = TRUE
and two actions to send emails at +7 and +14 daysMyRecord
that met entry conditionsRESULT:
Setup | Time-based Workflow
shows 2 pending entries for +7 and +14 days for recordMyRecord
I then updated the Flow to Version 2 and added an additional entry condition such that the emails get scheduled when
Is_FieldA__c = TRUE AND Is_FieldB__c = TRUE
Upon updating
MyRecord
such that FieldA was TRUE but FieldB was FALSE...RESULT:
Setup | Time-based Workflow
shows 0 pending entries for recordMyRecord
That is, changing the flow version and amending the entry conditions in the new version will apply to records that scheduled elements under prior versions - thus enabling one to introduce new criteria over time to remove in-flight scheduled actions and not needing to resort to the complexities associated with Process Builder.
Side bar
I surmise this works because Scheduled Paths on record-triggered flows come directly out of the flow's entry conditions. In Process Builder, you can have many decision criteria nodes, some of which are attached to Scheduled Actions. Thus, when the Process Builder changes versions, SFDC essentially assumes the entire old Process Builder is effectively NOP and the only thing Salesforce will do is accelerate/defer the scheduled events of the old version if the underlying reference date changes.