You need to sign in to do that
Don't have an account?
rcraven
Validation of fields during an Approval Process Step, Is this Possible?
The original submitter doesn't have access to certain fields, let's say PO number and License Number. These fields need to be updated during a specific reviewal/approval step.
Is it possible to validate that these fields have been filled in during a specific approval step? And if not dissallow approval?
Any help is very appreciated.
You can do this in a trigger as follows. There might be an easier built in way, but this works.
trigger tgrValidateApproval on YourObjectNameHere (before update) { for (Integer i = 0; i < trigger.new.size(); i++) { if (trigger.old[i].ApprovalStatus != trigger.new[i].ApprovalStatus && trigger.new[i].ApprovalStatus == "Approved") { //here is a validation check - add more of these if needed, and maybe even build up a single error msg for all. if (trigger.new[i].Some_Value__c == null){ trigger.new[i].addError("Approval Failed because SomeValue is blank."); } } } }
Agree this would work for a custom object, however, we are using the Salesforce Approval WF.
The API does not allow triggers to be create on the ProcessInstanceStep object. Ideally, we would like to dissallow the approval.
However, if the approval step updates a field on a custom object, we could write an update trigger like your peudo code, but that is after the fact it's been approved, and we would need to rollback to the previous approver. Yuck!
Do you know how to rollback to the previous approval step using Apex? Is this possible?