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());
}
}
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
Post a Comment