Submitting an Opportunity into an approval when the Opportunity Stage is updated.

When setNextApproverIds is passed a List with a single ID in the list then the code works, when the list contains more than one ID then the following exception is thrown:

12:12:02.196 (6196664000)|EXCEPTION_THROWN|[454]|System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [] 12:12:02.197 (6197779000)|USER_DEBUG|[459]|DEBUG|ERROR LOCKING OPPORTUNITY: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: []

private static void submitAndApprovalRecord(Set<Id> recordIds) {
    will take an id and submit that record to an approval locking the record
    try {
        List<Approval.ProcessSubmitRequest> submitApprovals = new List<Approval.ProcessSubmitRequest>();

        for (ID recordId:recordIds) {

            list<ID> approverIds = new List<ID>{Properties.OpportunityApprovalLockUserId};
            for(GroupMember gm : [select UserOrGroupId From GroupMember where Group.DeveloperName = Group Name']){
            system.debug('***approverIds: ' + approverIds);

            Approval.ProcessSubmitRequest submitApproval=new Approval.ProcessSubmitRequest();
            submitApproval.setComments('Submitted for approval. Please approve.');



        // Submit the approval requests for the records 
        Approval.ProcessResult[] results=Approval.process(submitApprovals, true);
        for (Approval.ProcessResult result : results) {
    } catch (Exception ex) {
        system.debug('ERROR LOCKING OPPORTUNITY: ' + ex);
  • possible duplicate of Apex approval process that requires unanimous approval from multiple approvers
    – eyescream
    Commented Apr 11, 2013 at 11:49
  • 1
    I had seen that. The difference is that this is not unanimous, but first response. Any of the approvers should have the ability to approve. It did cross my mind that there is no option for this in apex. Commented Apr 11, 2013 at 12:25
  • Can you modify your approval process to send it to a queue instead of "list of people"? Queue (even in approval marked as unanimous) will work on "first come first served".
    – eyescream
    Commented Apr 11, 2013 at 12:39
  • Is it possible that one of your approvers is also an opp owner? Also, what happens if you change the option on Approval.ProcessResult[] results=Approval.process(submitApprovals, true); to (submitApprovals, false) allowing partial success?
    – crmprogdev
    Commented Apr 11, 2013 at 14:25

1 Answer 1


REQUIRED_FIELD_MISSING error when Approval Process set to Manually Select Hi, This is may help you. I met this question same as your, and this is useful for me.

You must log in to answer this question.

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