activate workflow and submitted through code in x++
//Triggered ERE Visa Request workflow after business trip workflow completion
if(employeeBusinessTrip.WorkflowStatus == DSPWorkflowStatus::Completed)
{
select visaRequest
where visaRequest.TripId == employeeBusinessTrip.TripId
&& visaRequest.EmployeeId == employeeBusinessTrip.EmployeeId;
if(visaRequest)
{
//Check whether we have a Active workflow on the table.
workflowVersionTable = Workflow::findWorkflowConfigToActivateForType(workFlowTypeStr(DSPEREVisaRequestWorkflowType),
visaRequest.RecId,
visaRequest.TableId);
//If workflow is active then submit the workflow.
if (visaRequest.RecId && workflowVersionTable.RecId)
{
//submitting to workflow
Workflow::activateFromWorkflowType( workFlowTypeStr(DSPEREVisaRequestWorkflowType),
visaRequest.RecId,
'Submitted',
false,
curUserid());
//Update the workflow status to Submitted on the table.
DSPEREVisaRequest::updateWorkflowStatus(visaRequest.RecId,
DSPWorkflowStatus::Submitted);
}
}
}
Comments
Post a Comment