public static void main(Args args)
{
FormDataSource callerDS;
FormRun formRun;
// TODO: Write code to execute once a work item is submitted.
// Variable declaration.
recId _recId = args.record().RecId;
WorkflowCorrelationId _workflowCorrelationId;
// Hardcoded workflow type name.
WorkflowTypeName _workflowTypeName = workflowtypestr("PayLeaveWorkflow");
// Initial note is the information that users enter when they
// submit the document for workflow.
WorkflowComment _initialNote = "";
WorkflowSubmitDialog workflowSubmitDialog;
// Opens the submit to workflow dialog box for user comments.
workflowSubmitDialog = WorkflowSubmitDialog::construct(args.caller().getActiveWorkflowConfiguration());
workflowSubmitDialog.run();
if (workflowSubmitDialog.parmIsClosedOK())
{
_recId = args.record().RecId;
callerDS = args.record().dataSource();
formRun = args.caller();
// Get user comments from the submit to workflow dialog box.
_initialNote = workflowSubmitDialog.parmWorkflowComment();
try
{
ttsbegin;
// Activate the workflow from a template.
_workflowCorrelationId = Workflow::activateFromWorkflowType(_workflowTypeName, _recId, _initialNote, NoYes::No);
ttscommit;
// Updates the workflow button to diplay Actions instead of Submit.
args.caller().updateWorkflowControls();
callerDS.research(true);
callerDS.reread();
callerDS.refresh();
}
catch(exception::Error)
{
// ToDo Insert your error code here.
}
}
}
Hi, Please check the code and review, I am not sure what is missing.. If it is not changing it is different thing. It is changing, but slow.