Monday 17 December 2018

Get Approver name from workflow history - ax 2012

Get Approver name from workflow history




public display Name displayApproverName()
{
    WorkflowTrackingTable           workflowTrackingTable;
    WorkflowTrackingStatusTable     workflowTrackingStatusTable;
    WorkflowTrackingCommentTable    workflowTrackingCommentTable;
    WorkflowTrackingWorkItem        workflowTrackingWorkItem;
    WorkflowWorkItemTable           workflowWorkItemTable;

    select ContextCompanyId, ContextTableId, ContextRecId from workflowTrackingStatusTable
        where workflowTrackingStatusTable.ContextCompanyId    == curext()
           && workflowTrackingStatusTable.ContextTableId      == this.TableId
           && workflowTrackingStatusTable.ContextRecId        == this.RecId
        join firstonly TrackingId, CreatedDateTime,user from workflowTrackingTable order by CreatedDateTime desc
            where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
        join workflowTrackingWorkItem where workflowTrackingWorkItem.WorkflowTrackingTable == workflowTrackingTable.RecId
        join workflowWorkItemTable where workflowTrackingWorkItem.WorkItemId == workflowWorkItemTable.Id  ;

    return workflowWorkItemTable.userName();
}

No comments:

Post a Comment