Find your content:

Search form

You are here

Submit records for approval in bulk without hitting DML Statement limit


I've got code to create and submit for approval a custom object. I'm running into the DML statement limit.

As far as I can see each record I submit for approval takes up a DML statement, but there's no option to submit in bulk.......

Am I missing something?

Attribution to: ChrisN

Possible Suggestion/Solution #1

You can submit multiple Records for approval, sample code below.

List<Approval.ProcessSubmitRequest> requests = new List<Approval.ProcessSubmitRequest> ();
     for (Id oppId: opportunities) {
                    Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
                    req1.setComments('Submitting request for approval ');

      Approval.ProcessResult[] processResults = null;
                try {
                    processResults = Approval.process(requests, true)
    }catch (System.DmlException e) {
        System.debug('Exception Is ' + e.getMessage());

Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content