Getting Approver Information from Workflow - Dynamics AX 2012

Task to get the last approver of the workflow. Job gives the output as name of the approver of the required ID of the workflow

static void workflowApproverInfo(Args _args)
{
    WorkflowTrackingStatusTable  workflowtrackingstatustable;
    WorkflowTrackingTable        workflowtrackingtable;
    
    while select workflowtrackingstatustable
        order by RecId desc
    join workflowtrackingtable
        where workflowtrackingstatustable.ContextRecId == 5637155826 //(Required Record)
           && workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem
           && workflowtrackingtable.TrackingType == workflowtrackingtype::Approval
           && workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable .recid
    {
    
        info(workflowtrackingtable.User);
    
        info(HcmWorker::find(DirPersonUser::findUserWorkerReference(workflowtrackingtable.User)).name());
    }
}

Comments

Popular posts from this blog

Export Data from AX 2012 - using DIXF (Data Migration Framework)

The virtual path maps to another application, which is not allowed

Agile Management - TFS (Priority, Stack Rank and Severity)