Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

RE: Workflow Submit Button To Action Button change is slow

$
0
0

Hi Noobdaxcoder,

Try this code

public void submit(Args _args)

{

   // Variable declaration.

   SalesTable                                         salesTable;                 //declare your table

   SalesOrderTypeSubmitManager       submitManger;        //here use your submit  class

   recId _recId =                                   _args.record().RecId;

   WorkflowCorrelationId                    _workflowCorrelationId;

   workflowTypeName                    _workflowTypeName =  

   workFlowTypeStr("Yourworkflowquery");      //your workflow query put here

   WorkflowComment              note = "";

   WorkflowSubmitDialog        workflowSubmitDialog;

   submitManger =                  new SalesOrderTypeSubmitManager();  //here use your submit  class

   //Opens the submit to workflow dialog.

   workflowSubmitDialog =

  WorkflowSubmitDialog::construct(_args.caller().getActiveWorkflowConfiguration());

   workflowSubmitDialog.run();

   if (workflowSubmitDialog.parmIsClosedOK())

   {

       salesTable = _args.record();

       note = workflowSubmitDialog.parmWorkflowComment();

       try

       {

           ttsbegin;

           // Activate the workflow.

           _workflowCorrelationId = Workflow::activateFromWorkflowType(_workflowTypeName, salesTable.RecId,             note, NoYes::No);

           salesTable.WorkFlowStatus = WorkFlowStatus::Submitted;

           salesTable.update();

           ttscommit;

        }

       catch (Exception::Error)

       {

           error("Error on workflow activation.");

       }

   }

   _args.caller().updateWorkFlowControls();

}


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>