function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
revathyrevathy 

it is possible to Mass submit approval process through apex code?

i tried mass submit approval process in apex code,it's working but only one record to submit at a time.see the below code,please help me on this
for(GE_LGT_EM_ComplaintLineItem__c con:selectedContactIds)
       {
                 
             system.debug('selected cli ids---->'+con.id);--------->here getting all selected records,but only one records going to submit succesfully.i need bulk submit?
                    Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
                    req1.setComments('Mass records Submitted from visulaforce Page! ');
                    req1.setObjectId(con.id);
                    req.add(req1);
                                     
                    Approval.ProcessResult[] processResults = null;
                    try {
                    processResults = Approval.process(req, true);
                    System.debug('final result--->'+processResults);
                    }catch (System.DmlException e) {
                    System.debug('Exception Is ' + e.getMessage());
                    }
                   
                   
        }
Deepak Kumar ShyoranDeepak Kumar Shyoran
Please refere to below links where similar problem is listed.

https://developer.salesforce.com/forums/ForumsMain?id=906F000000091nLIAQ
http://www.jitendrazaa.com/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/