0

Background information: I currently have two validation rules that I am trying to bypass in a record-triggered flow. The flow is for the Case Object. Since, record-triggered flows run in system context without sharing, I assumed it would bypass those validation rules but those rules are being triggered.

Solutions I've seen while researching:

Note: I am looking for a solution that doesn't require adding another field to the Case Object.

Thank you for your help.

3
  • 5
    Remember - Validation Rules apply to the database layer so any change to the data goes through those VRs - regardless of reason - Flow, UX, REST, DataLoader, etc. Thus, they can only be bypassed based on running user context or record data and only if VRs caters for those as conditions
    – cropredy
    Oct 31, 2022 at 19:59
  • 2
    +1 to cropredy's comment. IMHO a validation rule should be written to only test its primary condition when one of the fields that contribute to that condition has changed (or when the record is new). You do this using ISNEW and ISCHANGED functions as a prefix for the primary condition.
    – Phil W
    Oct 31, 2022 at 20:20
  • 3
    If you find yourself having to bypass validation rules, then either you have to modify the validation rules to allow loopholes for user context / record data, or you should eliminate the validation rules entirely and build validation into your automation. Nov 1, 2022 at 2:40

1 Answer 1

0

You can create:

  1. a custom setting type Hierarchy.(exemple bypass)(you can apply to user or profile) List item enter image description here

  2. create a field of type checkBox (exemple : validationBypass)

  3. in your validation do it like this (AND(NOT($Setup.bypass__c.validationBypass__c)), ...the rest of your logic)

  4. in your custom setting create a data set for a user or profile by making the checkbox checked.

This will make sure your validation rules are not triggering for certain user or profile.

Ps: bypass validation should be done only in specific case. Don't not apply to all user or profile. The purpose of the validations rules are there to ensure data quality. If your validations are triggering thats means that your data may not be in the correct format.

You must log in to answer this question.

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