Basically, I want to have validation rules run when a step in an approval process is approved. I would like the rule to take into account which step triggered the rule, so that each step can have different requirements for approval. Is this possible? Thanks!
Attribution to: jackerman09
Possible Suggestion/Solution #1
A custom field for Step Number, or the Status field you were referring to
So on each Approval Step, say Step 1 Have an Approval Action to update the field to Step 1, indicating that Step 1 is approved. Have a validation rule which summarises the data requirements for approval
OR(
AND(Text(Status__c) = 'Step 1', ISBLANK(AccountNumber__c)), // Step 1 Approval Check
AND(Text(Status__c) = 'Step 2', ISBLANK(SomeOtherField__c) // Step 2 Approval Check
)
This will return an error to the Approver in each step if they haven't supplied the required information before approving. (The validation rule will be triggered by the Process attempting a Field Update on Approval)
CORRECTION :
That might not work. login.salesforce.com/help/doc/en/approvals_considerations.htm says 'Field updates don’t evaluate custom validation rules on fields.' :/ So this may not be possible to do
Don't know if an addError via a trigger will be any different.
Attribution to: techtrekker
Possible Suggestion/Solution #2
Validation rules wont work... handle this using trigger. Step 1: Update field using approval actions Step 2: write a trigger and validate the record fields.
Attribution to: Sunny
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3345