+ Start a Discussion

bypass validation rules issue

I have an issue here. I have an object O1 and a field F1. Field F1 is getting updated when an record is created in another object O2 by a trigger running on object O1.
Field F1 cannot be edited by inline.
There is are validtions rules on object O1.
I need when i create a record in object O2 all the validation rules in O1 should get by passed and field F1 should get updated.
But when an user does an inline edit on a record present in object O1 the validation rule should fire.

To achieve this i am making the custom setting to true and in the validation rule i am using like below - 
​( $Setup.ByPassvalidation__c.Bypassrules__c ) && (TODAY() > PRIORVALUE(CloseDate))

This is working fine when i am inserting record in object O2. But if a user does an inline edit in object O1 the validation rule is not wokring.

Can anyone tell how to make this work.
Chris  ByromChris Byrom
Are you setting the custom setting back to false when you are done with your insert?
deepak balur 19deepak balur 19
Your validation is not able to distinguish where the DML operation is coming from. You need an additional identified on the record to make that distinction and include in your validation rule.