You need to sign in to do that
Don't have an account?
chris_centra
approval with multiple approvers....error?
Hello.
I have a trigger which creates Approval Requests. I have the following block of code:
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(newOpp.Id);
List<Id> nextAppIdList = new List<Id>();
nextAppIdList.add('00580000001pucY');
nextAppIdList.add('00580000001pucxAAA');
req1.setNextApproverIds(nextAppIdList);
//Submit the approval request for the solution
Approval.ProcessResult result = Approval.process(req1);
Note that there are multiple Approver Ids in the setNextApproverIds() call…
So if I run the code above, I get the following error:
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger opportunityApprovalTrigger caused an unexpected exception, contact your administrator: opportunityApprovalTrigger: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: []: Trigger.opportunityApprovalTrigger: line 61, column 45
Note that line 61 is: Approval.ProcessResult result = Approval.process(req1);
However, if I change the code so that I’m only submitting single approver, it works perfectly. What am I doing wrong?
Thanks
Chris
I have a trigger which creates Approval Requests. I have the following block of code:
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(newOpp.Id);
List<Id> nextAppIdList = new List<Id>();
nextAppIdList.add('00580000001pucY');
nextAppIdList.add('00580000001pucxAAA');
req1.setNextApproverIds(nextAppIdList);
//Submit the approval request for the solution
Approval.ProcessResult result = Approval.process(req1);
Note that there are multiple Approver Ids in the setNextApproverIds() call…
So if I run the code above, I get the following error:
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger opportunityApprovalTrigger caused an unexpected exception, contact your administrator: opportunityApprovalTrigger: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: []: Trigger.opportunityApprovalTrigger: line 61, column 45
Note that line 61 is: Approval.ProcessResult result = Approval.process(req1);
However, if I change the code so that I’m only submitting single approver, it works perfectly. What am I doing wrong?
Thanks
Chris
Did you ever get to resolve this issue? I am running into the same issue as well
i'm afraid i don't remember whether i found a solution to this. sorry and best of luck to you.
chris
Did anybody find a solution or a workaround for this issue?
Thanks.
List<Approval.ProcessSubmitRequest> requests = new List<Approval.ProcessSubmitRequest>();
and put the approvers in their own request
loop through approval people
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1 info here
end of loop
List< Approval.ProcessResult> result = Approval.process(requests);
It creates different approvals though and not one with many users :(