Saturday, June 23, 2018

Retrieve last approver name for any workflow

Below code can be used to retrieve last approver name for any workflow activated in Dynamics AX/ 365 Finance and operations.

 static void dtGetLastApproverName(Args _args)  
    WorkflowTrackingStatusTable workflowTrackingStatus;  
    WorkflowTrackingTable workflowTrackingTable;  
    WorkflowTrackingCommentTable workflowTrackingCommentTable;  
    UserInfo userInfo;  

    select firstFast RecId, User from workflowTrackingTable  
     order by RecId desc   
     join workflowTrackingCommentTable   
    where workflowTrackingCommentTable.WorkflowTrackingTable ==   
    join UserInfo where == WorkflowTrackingTable.User  
    exists join workflowTrackingStatus  
    where workflowTrackingTable.WorkflowTrackingStatusTable ==   
    && workflowTrackingStatus.ContextRecId == _salesRecId //PurchRecID  
    && workflowTrackingStatus.ContextTableId == tableNum(SalesTable) //SalesTable  
    && workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;  

    if (workflowTrackingTable.RecId > 0)  
      info(strFmt(“%1 – %2 “,, workflowTrackingCommentTable.RecId));  

No comments:

Post a Comment

ADFS configuration error Invalid scope names

I am about to finish On-Prem deployment, where i was facing error at   step number 18     as below: "ADFS configuration for premises ...