Hi Guys, I share how to Get Workflow Information AX using X++ :
Get workflow information using x++ :
Display str ApproveDate()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
Name _name;
select firstFast RecId, User from workflowTrackingTable
order by RecId desc
join workflowTrackingCommentTable
where workflowTrackingCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId == _getPR.RecId
&& workflowTrackingStatus.ContextTableId == tableNum(PurchreqTable) //PurchTable
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;
if (workflowTrackingTable.RecId > 0)
{
return ": " + strFmt('Approve Date : %1 - Approve Name : %2', datetime2str(workflowTrackingCommentTable.createdDateTime,123), userInfo.name);
}
else
{
return '';
}
}
Ask me if you have a problem, please email to : adityomagnet@gmail.com
Get workflow information using x++ :
Display str ApproveDate()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
Name _name;
select firstFast RecId, User from workflowTrackingTable
order by RecId desc
join workflowTrackingCommentTable
where workflowTrackingCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId == _getPR.RecId
&& workflowTrackingStatus.ContextTableId == tableNum(PurchreqTable) //PurchTable
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;
if (workflowTrackingTable.RecId > 0)
{
return ": " + strFmt('Approve Date : %1 - Approve Name : %2', datetime2str(workflowTrackingCommentTable.createdDateTime,123), userInfo.name);
}
else
{
return '';
}
}
Ask me if you have a problem, please email to : adityomagnet@gmail.com