Hi Guys
This post targeting developers and help them submitting the document like free text invoice to workflow automatically using code.
static void WorkflowAutoSubmit(Args _args)
{
WorkflowVersionTable workflowVersionTable;
custInvoiceTable _custInvoiceTable;
boolean submited = true;
workflowVersionTable = Workflow::findWorkflowConfigToActivateForType(
workFlowTypeStr(CustFreeTextInvoiceTemplate),
_custInvoiceTable.RecId,
_custInvoiceTable.TableId);
if (_custInvoiceTable.RecId && workflowVersionTable.RecId && _custInvoiceTable.WorkflowApprovalState == CustFreeInvoiceWFApprovalState::NotSubmitted)
{
// submitting to workflow; if auto workflow submission is required on journal.
Workflow::activateFromWorkflowType(
workFlowTypeStr(CustFreeTextInvoiceTemplate),
_custInvoiceTable.RecId, "auto submit to workflow",
false,
curUserid());
custInvoiceTable::setWorkflowState(_custInvoiceTable.RecId, CustFreeInvoiceWFApprovalState::Submitted);
info("invoice submitted to workflow");
}
else
{
submited = false;
}
}
Thanks
Happy Daxing