• sacrengan2
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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