Skip to main content


Showing posts from October, 2017

First error: Process failed. First exception on row 0; first error: INVALID_OPERATION, Illegal transition type: []

Approving a record through APEX error Searched return no relevant results to the issue I encountered. I encountered this when writing a schedulable class and thought it was due to SF restriction inside the limited context of the scheduler; so posting this in hopes it saves others some frustration and time. The solution Check the spelling when specifying the action (see Docs here ). In my case I had Approved instead of Approve , allowed options are Approve , Remove d , and Reject . ... Approval.ProcessWorkitemRequest oPWR = new Approval.ProcessWorkitemRequest(); oPWR.setComments('Auto approved through JobId: \'' + oBatchableContext.getJobId() + '\''); oPWR.setAction('Approve'); // allowed choices are 'Approve`, `Removed`, `Reject`. oPWR.setWorkItemId(oWorkItemCurrent.ID); Approval.ProcessResult oPR = Approval.process(oPWR); ... If this has helped you feel free to comment or follow me on twitter @danielsokolows .