This is the Code for the Submit Button , when i run this from the WorkFlow Created Button (Submit) it works....
but if i call this method from the Job , it says Object object not initialized at the line of
workflowSubmitDialog = WorkflowSubmitDialog::construct(args.caller().getActiveWorkflowConfiguration());
I called that submit Method like this from the Job
SalesCreditLimitApprSubmitManager salesCreditLimitApprSubmitManager = new SalesCreditLimitApprSubmitManager();
Args args = new Args();
SalesTable SalesTable;
select SalesTable where SalesTable.RecId == this.RecId;
args.record(SalesTable);
salesCreditLimitApprSubmitManager.submit(args);
void submit(Args args)
{
//Variable declaration.
RecId recId = args.record().RecId;
WorkflowCorrelationId workflowCorrelationId;
// Hardcoded type name
WorkflowTypeName workflowTypeName = workFlowTypeStr(SalesCreditLimitAppr);
//Initial note is the information that users enter when they
//submit the document for workflow.
WorkflowComment note ="";
WorkflowSubmitDialog workflowSubmitDialog;
SalesTable SalesTable;
//Opens the submit to workflow dialog.
workflowSubmitDialog = WorkflowSubmitDialog::construct(args.caller().getActiveWorkflowConfiguration());
workflowSubmitDialog.run();
if (workflowSubmitDialog.parmIsClosedOK())
{
recId = args.record().RecId;
SalesTable = args.record();
// Get comments from the submit to workflow dialog.
note = workflowSubmitDialog.parmWorkflowComment();
try
{
ttsbegin;
workflowCorrelationId = Workflow::activateFromWorkflowType(workflowTypeName, recId,note,NoYes::No);
SalesTable.CreditLimitApprovalStatus = SalesCreditLimitApprovalStatus::Submitted;
// Send an Infolog message.
info("Submitted to workflow.");
ttscommit;
}
catch(exception::Error)
{
info("Error on workflow activation.");
}
}
args.caller().updateWorkFlowControls();
}