1

I have a picklist field on opportunity, which contains some values for example: A, B, C, D

The user must be able to update A or C during record edit if he tries to edit values other than A and C validation rule fires. But when trigger fires it should be able to update any of the values validation rule should not be fired.

I tried creating one flag on opportunity but this method will allow both system and user to edit the field.

So please provide any suggestions on this??

2
  • You can stop users from modifying the flag on opportunity by making the field not visible using profile field level security or removing the field from the opportunity layout.
    – Keith C
    Jul 16, 2014 at 16:25
  • So, the trigger will be invoked via use cases other than user input - such as data loader or API? And in those cases, the VR should not execute but if user entry, the VR should execute?
    – cropredy
    Jul 16, 2014 at 16:49

2 Answers 2

1

You can use a custom setting in the validation rule and change its value in the trigger, so that the validation rule does only fire during a user interaction. The idea is described here: Make Validation Rule bypass if TRIGGER is run?

Be aware that in a Salesforce org with a lot of traffic, this pattern could lead to sporadic locks on the custom setting.

1
0

Create checkbox field on object which have validation rule, change value of that field whenever you want to bypass validation rule, it may be from Apex class or trigger or process builder. In validation rule put And condition as below :- AND(!ISCHANGE(created_field),(Your original condition))

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.