function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pooja biswaspooja biswas 

validation rule for Lead object

Hi
Please validate my understanding
In Lead object, I have custom text field say Amount, data type=Number.
I have defined a validation rule on Lead object, if Amount < 1000 then ok else throw error
Now I have created a workflow rule on lead, some criteria, then field update on Amount object.

what happens when new Lead record created if amount > 1000, my guess it should throw error.
Please validate

Thanks
Pooja
Best Answer chosen by pooja biswas
Akhil AnilAkhil Anil
Hi Pooja,

It won't throw an error, because the validation rule runs before the workflow rule. So when the workflow updates the amount to a value greater than 1000, the validation rule is not re-triggered again and hence it will NOT throw any error.

Check the order of execution in Salesforce in the below link. Check the point no 12 which specifically mentions that validation rules do not run again after workflow field updates.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm

Kindly mark it as an answer if that resolves your query !

All Answers

Akhil AnilAkhil Anil
Hi Pooja,

It won't throw an error, because the validation rule runs before the workflow rule. So when the workflow updates the amount to a value greater than 1000, the validation rule is not re-triggered again and hence it will NOT throw any error.

Check the order of execution in Salesforce in the below link. Check the point no 12 which specifically mentions that validation rules do not run again after workflow field updates.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm

Kindly mark it as an answer if that resolves your query !
This was selected as the best answer
pooja biswaspooja biswas
Thanks