2

I am creating an Approval Process. Its a simple process with 2 approval steps I have a requirement where an assigned approver (user) must populate one or more fields on a record before they approve or reject it. If the field is not populated the user must be notified with a message on the vf page and the approve or reject selection must be interrupted. So basically i don't want them to be able to approve or reject a record unless they have entered data in the fields. I can prevent the record from entering the next step by validating the fields in the approval step conditions but this will not allow me to provide the user with real time notifications so they can populate the fields and approve or reject right away

Anyone have ideas on how to implement this ? I was trying to see if i can override methods on a custom controller extension do my validation and then pass it on to the standard Approval Process methods but i can't find any examples

  • Sounds like a straight forward validation but it looks like the standard approval process does not make it easy. Here is a similar question but it does not appear to have a final solution. salesforce.stackexchange.com/questions/3345/… – Richard N Dec 15 '14 at 22:03
  • is it in any way helpful to include a Boolean field update upon entry into the Approval Process to set myObj.is_in_approval_process__c = true? This way, your validation rules know context – cropredy Dec 16 '14 at 2:57
  • the field to set of a validation rule in the approval set would be great but validation rules don't seem to be run in approval steps – user2525898 Dec 16 '14 at 22:29
0

Use trigger... validation rules will not work. Update field using approval actions and do the validation in trigger.

0

It can be achieve using trigger.

for(Object cr : Trigger.New)
    {
        String oldStatus=Trigger.oldMap.get(cr.Id).Status__c;
        if(cr.Status__c==CR_STATUS_APPROVED && oldStatus!=CR_STATUS_APPROVED)
        {
            // Effective Date is required if approved

            if(cr.effective_date==null) 
            {

                isValid = false;
                cr.addError('You must supply an effective date in order to approve the object.);
            }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.