Thursday, October 24, 2019

How to trigger the Workflow and update the workflow status using X++


WorkflowVersionTable        workflowVersionTable;


//Check whether we have a Active workflow on the table.
workflowVersionTable = Workflow::findWorkflowConfigToActivateForType(workFlowTypeStr(KMTSalesAgreementLineWFType),
                                                                             agreementLine.RecId,
                                                                             agreementLine.TableId);

        //If workflow is active then submit the workflow.
        if (agreementLine.RecId && workflowVersionTable.RecId)
        {
            //submitting to workflow
            Workflow::activateFromWorkflowType( workFlowTypeStr(KMTSalesAgreementLineWFType),
                                                agreementLine.RecId,
                                                "@KMT_Label:AutoSubmitWorkflow",
                                                false,
                                                curUserid());
           
            //Update the workflow status to Submitted on the table.
            salesAgreementHeader::updateWorkflowStatus(agreementLine.RecId,
                                                       KMTSalesAgreementWFStatus::Submitted,
                                                       NoYes::No);
        }

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...