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();
}