0

I have written custom code to submit record for approval to different users.assume there are 10 users received approval requests among those at-least one user approves or rejects record the status of the approve/reject should be reflects to all other users(when they open email link they should see approve/reject status not "pending" status).Here i am able to submit request to all emails which i specified in code.please guide me

Code:

public static void submitRequestForApproval(Account acc){
        integer intRegion;
        set<string> strEmails = new set<string>();
        set<id> userId = new set<id>();
       if(acc.place__c!= null){
           intRegion = integer.valueOf(acc.place__c);
       }
       list<user> userList = [select id,email from user where Email IN: strEmails];
       list<Approval.ProcessSubmitRequest> reqList = new list<Approval.ProcessSubmitRequest>(); 
       for(user use : userList){
        Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
        req.setComments('Submitted request for approval');
        req.setObjectId(acc.id);
        req.setNextApproverIds(new id[] {use.id});
        reqList.add(req);
       }

       list<Approval.ProcessResult> result = Approval.process(reqList);
   }
2
  • You didn't mention whats the issue you are facing? Jan 26, 2018 at 14:47
  • now i am able to submit for approval but how can achieve "if a record is submitted for approval to different users,if any one of them approves or rejects it should reflects to all other users"
    – Sfdc
    Jan 26, 2018 at 15:34

1 Answer 1

2

If a record is submitted for approval to different users,if any one of them approves or rejects it should reflects to all other users

Solution

In the Approval Steps, at Step 3: Select Assigned Approver, choose Approve or Reject based on FIRST Response.

Select Assigned Approver

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .