function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Danielle SDanielle S 

by pass validation rules in flows

Hi all, 
I have a flow that update a custom field called Comment. from the Account record page , a user select multiple opportunities and update this fields.
The problem, is when Close date is in the past , the flow is producing an error because of the validation rule that we have for close date ( must be in the present or in the future). 
Could you please advice on a solution to prevent this error to occur ? 
thank you 
VinayVinay (Salesforce Developers) 
Hi Danielle,

Check below examples to by pass validation rules in flows.

https://jenwlee.com/2021/04/05/bypass-validation-rules-in-a-flow-and-process-too/
https://admin.salesforce.com/blog/2022/how-i-solved-this-use-a-toggle-and-flow-to-escape-validation-rules

Also kindly review below limitation.
https://ideas.salesforce.com/s/idea/a0B8W00000GdguMUAR/let-flow-automatically-bypass-validation-rule

Please mark as Best Answer if above information was helpful.

Thanks,
Danielle SDanielle S
Hi @Vinay
I tried both solutions provided in the articles you shared but for some reason , it does not work.
The first problem is that the validation rule does not fire when we update opportunities with close date in the past. 
Indeed, when I update the flow using the flow , I am getting an error. 
 for the solution with the Toggle : I have a doubt about hte fomulat. I followed what they did in the article and I selected my Get opportunities variable and I added .Toggle__c , but I got this error :  The element has an invalid reference to "Get_opportunities.Toggle__c". 

User-added image
Then I tried to this formulat : IF(Toggle__c}= TRUE, FALSE,TRUE) , then I got The formula expression is invalid: Syntax error
I finally used : IF({!recordId.Toggle__c}= TRUE, FALSE,TRUE) , the syntax is correct but the flow is not working .
User-added imageUser-added image
Below is the Ge Record element I used in the flow 
User-added image
I appretiate your help and advice, 
thnak you !