public void submitForApproval(Opportunity opp) { // Create an approval request for the Opportunity Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval automatically using Trigger'); req1.setObjectId(opp.id); req1.setNextApproverIds(new Id[] {opp.Next_Approver__c}); // Submit the approval request for the Opportunity Approval.ProcessResult result = Approval.process(req1); }
More info:
http://www.jitendrazaa.com/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/
No comments:
Post a Comment