You need to sign in to do that
Don't have an account?
Manjunath T N
How to pass the parameter from trigger to validation rules?
I have a trigger on Contract Object, whenever the Contract record is updated the contract section in the associated opportunities will also get updated with the latest Contract data but while updating Contract record, Contract section in associated Opportunities is not updating instead I am getting validation errors which is created on Opportunity object.
Now I want to stop Opportunity validation rules when I update the contract section of Opportunity object from Contract trigger. Is there anything that we can pass from trigger to validation rules to stop validation rules errors? Please help me.
Now I want to stop Opportunity validation rules when I update the contract section of Opportunity object from Contract trigger. Is there anything that we can pass from trigger to validation rules to stop validation rules errors? Please help me.
In your contract trigger, set the value of this boolean variable to false (default value will be true). In this way, you will be able to skip the Opportunity trigger whenever an update happens on Contract object.
In the validation rule, keep a condition as below
IF(Skip_Validation_Rule__c, <Your exisitng validation rule comes here>, false)
Solution which I have implemented is:
I have converted the opportunity validation rules (2 validation rules) which are causing this issue to Apex code (Opportunity Trigger) and I have created one global boolean variable. So whenever I update opportunities from Contract? before opportunity update, I will set the value of boolean variable to true and then I will update the opportunity after updating opportunity, again I will set back the value of boolean variable to false. in Apex code (Opportunity Trigger) I have written a condition that if the boolean variable value is set to true then I will skip the validation rule which is converted into apex code so that I will not get these validation errors and opportunity will get update.