Activity Forums Salesforce® Discussions How to bypass validation rules without adding anything in validation rule ?

  • How to bypass validation rules without adding anything in validation rule ?

    Posted by Abhinav on October 16, 2019 at 7:38 am

    Bypass validation rule while updating record in apex class without adding anything in validation rule.

    Joseph replied 4 months, 3 weeks ago 4 Members · 4 Replies
  • 4 Replies
  • Yogesh

    Member
    October 17, 2019 at 7:19 am

    Hello,

    Below are the steps for allowing certain users to bypass a Validation Rule :

    1. Create a Custom Permission.
    2.Create a Permission Set and mark the Custom Permission as active in that set.
    3.Assign users to the Permission Set who should be able to bypass the Validation Rule.
    4.a line to the Validation Rule that references the Custom Permission

  • Abhinav

    Member
    October 21, 2019 at 12:21 pm

    Hi ,Yogesh

    I cannot modify the existing validation rule .

  • Saddam

    Member
    October 21, 2019 at 12:56 pm

    Hi,

    Here is one strategy to bypass this behavior:

    Add a "Skip Validation" Checkbox field to the object
    Set the "Skip Validation" field to TRUE in a before trigger.
    Add logic to your validation rules so that they do not execute if "Skip Validation" is set to TRUE.

  • Joseph

    Member
    February 28, 2023 at 3:27 pm

    Could you please say why you decided it is a good solution? are you really helping or just showing off? I mean author said "WITHOUT" changing VR. And you give a solution that requires changing VR.At least have respect to pay attention to this and say: "Unfortunately, I don't know the answer that fully meets the criteria, but here is an option to bypass a VR. Just in case, despite you never asking for any solution, you asked for a specific solution, w/o editing VR."

    -Hello, how can I enter my car house w/o breaking the windows, if I lose the keys?-Break windows! -Thanks, smart guy!

Log In to reply.

Popular Salesforce Blogs