1

I have written a validation rule on quote which prevents users from changing the value of a checkbox "User_Flag__c" whenever the quote status is "Cancelled".We have a custom button on opportunity which sets the checkbox "User_Flag__c" to true whenever a quote is being cancelled.This is breaking the validation rule.The error message displayed on opportunity is:

System.DmlException: Update failed. First exception on row 0 with id xxxx; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, User Flag cannot be changed: [User_Flag__c]

Here is my validation rule:

AND(
    NOT($User.ByPass_VR__c),
    AND(
       ISPICKVAL( Status__c , "Cancelled"),
       ISCHANGED( User_Flag__c )
   )
)

is there any way to avoid this?

  • create a checkbox field and make it as true on the logic of clicking the button and update the validation rule to check the new field has a boolean flag of false to fire the validation rule,AND( NOT($User.ByPass_VR__c), AND( ISPICKVAL( Status__c , "Cancelled"), ISCHANGED( User_Flag__c ),NOT(newfield) ) )..However if users are not allowed to update the field then why is that done through button? – Preya Feb 16 '17 at 10:10
  • User_Flag__c field is being used in integration to pass the value to other system. – sfdcdev Feb 16 '17 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.