0

We have a new approval process with filter criteria set as opportunity discount greater than or equal to 2.0,Only then the submitter is allowed to submit the approval.Is it possible to auto submit the approval when the filter criteria is met?ie,instead of manually pressing the Submit for Approval button will it be possible to submit it Automatically?

1

You can send record to approval process via a trigger that checks your filter criteria on creation and update.

This should be something like

    // Create an approval request for the opportunity
    Approval.ProcessSubmitRequest req1 = 
        new Approval.ProcessSubmitRequest();
    req1.setComments('Submitting request for approval.');
    req1.setObjectId(opp.id);

    // Submit on behalf of a specific submitter
    req1.setSubmitterId(user1.Id); 


    req1.setProcessDefinitionNameOrId('PTO_Request_Process');

    // Submit the approval request for the account
    Approval.ProcessResult result = Approval.process(req1);

Reference

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.