I get the below error on some opps not all but some and I have no clue why. Any help would be great

"OpportunitySubmitForApproval2: execution of AfterUpdate

caused by: System.DmlException: Process failed. First exception on row 0; first error: ALREADY_IN_PROCESS, Cannot submit object already in process.: []

Trigger.OpportunitySubmitForApproval2: line 15, column 1"

Here is my code

Trigger OpportunitySubmitForApproval2 on Opportunity (after update) {
 for (Opportunity opp : Trigger.new){
  if (opp.Stagename =='Sent To Accounting'){
    Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
    req.setComments('Submitted for approval.');

    // submit the approval request for processing

    Approval.ProcessResult result = Approval.process(req);

    // display if the reqeust was successful

    System.debug('Submitted for approval successfully: '+result.isSuccess());


1 Answer 1


I am sure your trigger is getting fire two time in same transaction.

Check trigger name in debug log with CODE_UNIT_STARTED in the line, if you find statement twice means your trigger is running twice.

Reasons could be multiples but most common reason is some workflow rule criteria is meet which is causing trigger to run again.

Check Triggers and Order of Execution link for more detail

And solution to this are also many but one solution which mostly developer do by using static variable in code logic so that during the execution of second time that code will not run again. check Using Static Methods and Variables link to learn how we can utilize static vairiables to stop code running again in the same transaction.

You must log in to answer this question.

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