I have a Workflow, which updates a field to 100. Also there is a validation rule that throws an error each time the value is 100. What will happen in this case.?
Salesforce processes rules in the following order:
Validation rules
Assignment rules
Auto-response rules
Workflow rules (with immediate actions)
Escalation rules
Validation Rules fire before workflow rules, so the record has to meet the validation rule criteria before the workflows get a chance to run. So, validation rule will not work when you update the workflow field.
Please refer to the below links which might help you further.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
As per Salesforce execution order, If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules, duplicate rules, and escalation rules are not run again.
Execution order : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm
So say for example, I have a field whose value eneterd is 200. Can you tell me what will happen in this case. Will the value change to 100(workflow)?. Or the validation will first check(200) accept it, and later the workflow will change it to 100. Am I right?
Greetings to you!
Salesforce processes rules in the following order:
Validation Rules fire before workflow rules, so the record has to meet the validation rule criteria before the workflows get a chance to run. So, validation rule will not work when you update the workflow field.
Please refer to the below links which might help you further.
https://help.salesforce.com/articleView?id=fields_validation_considerations.htm&type=5
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
In your case, validation rule will be skipped.
As per Salesforce execution order,
If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules, duplicate rules, and escalation rules are not run again.
Execution order : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm
Please let us know if this helps.
Thanks,
Govindaraj.S
Thanks for the reply.
So say for example, I have a field whose value eneterd is 200. Can you tell me what will happen in this case. Will the value change to 100(workflow)?.
Or the validation will first check(200) accept it, and later the workflow will change it to 100.
Am I right?
Thanks
Prachi