Auto Submit Workflow for Approval in Ax 2012

Sometimes we need to submit Auto Submit Workflow for Approval in Ax 2012 then you can try below code by job. One thing you need to remember submitter should not be approval in workflow designer if its then this job may create some issue on approval.

Rest is fine you can use this code for your customization.


 Inventtable inventtable =InventTable::find("628034tr1");  
 Workflow::activateFromWorkflowType("InventApprWFType", //Template name  
 inventtable.RecId, //Record id of the document that you are submitting,  
 'Auto-Submitted into workflow', //A comment for the workflow history to know something about how this was submitted,  
 false,//This document wasn't submitted from the web,  
 'userid1'); // T  
   info("done");  

No comments: