Sunday, February 12, 2017

Approve Workflow by Code x++


WorkflowWorkItemTable WorkflowWorkItemTable;

    while select WorkflowWorkItemTable
    where
        WorkflowWorkItemTable.UserId == 'hasan.bi'
    &&  workflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem
    &&  workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending
    &&  WorkflowWorkItemTable.RefTableId == tableNum(CPMContractAdvanceRequest)
    {
        WorkflowWorkItemActionManager::dispatchWorkItemAction(
                                    WorkflowWorkItemTable,
                                    "Auto Approve by ADMIN", // comment
                                    'hasan.bi', // << user ID
                                    WorkflowWorkItemActionType::Complete,
                                    "CPMContractAdvanceRequestAppApprove", // << menu item action approval workflow
                                    false); //is not web Menu Item
    }

0 yorum:

Post a Comment