0

I am trying to bypass a validation rule on the Opportunity object from within a Flow. I have attempted this using the 'Toggle' technique as seen here: https://admin.salesforce.com/blog/2022/how-i-solved-this-use-a-toggle-and-flow-to-escape-validation-rules?_ga=2.24785081.2059426328.1666795622-1499501916.1666795622.

  1. I created a Toggle field on the Opportunity object.
  2. I added 'NOT(ISCHANGED(Toggle__c))' to the Validation Rule I am trying to bypass.
  3. In the Flow, I created a formula variable called “ChangeToggle” using an IF formula “IF(Toggle__c = TRUE, FALSE,TRUE)”

Here is a screenshot of the Flow:

enter image description here

All of the highlighted Nodes is where I have an assignment when I assign the 'Toggle' field to either True/ False in order to bypass the Validation Rule.

Here is an example for the Spring 2020 condition.

enter image description here

I then add this to a Collection Variable.

At the end of the Flow I update the Collection Variable.

From the debug logs it looks like the Toggle field is being updated:

enter image description here

But the Validation Rule is still being triggered:

enter image description here

1
  • Have you checked order of execution? In some situations, validation rules run before flows and apex. Commented Oct 27, 2022 at 15:43

1 Answer 1

0

If you are referring standard validation rule on object then I would recommend to tweak your validation rule rather than flow. If you have the condition which you were planning to use during flow execution, use those in validation rules.

If validation rule can't reference those condition due to advanced logic/complexity, you could also plan to move that validation to Apex trigger using addError() method and fine tune the condition there. So you don't have to implement these bypass on each flows or future enhancements.

You must log in to answer this question.

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