Helps to find the approvals tracking like who and all are approved so far for the particular workflow and what are the workflow approval comments as such in X++ code.
private str getworkflowTrackmessage(WorkflowInstanceNumber _instanceNumber)
{
WORKFLOWTRACKINGSTATUSTABLE w;
WORKFLOWTRACKINGTABLE wt ;
WORKFLOWTRACKINGTABLE wt2;
workflowsteptable wst;
workflowElementtable wet;
workflowTrackingWorkItem wtw;
UserInfo user;
UserInfo user2;
str txt,ret;
workflowtrackingcommenttable wtct;
boolean first=true;
while select * from w ORDER BY wt2.CREATEDdATEtIME ASC
where w.instANCEnUMBER==_instanceNumber//'INS2380404'//INS2383500'//
join wt2 where w.recId == wt2.workflowTrackingStatusTable && wt2.USER!='axwfexec'
join wtct where wt2.RecId==wtct.WorkflowTrackingTable
outer join wtw where wt2.recId==wtw.workflowTrackingTable
outer join wst where wst.stepId == wt2.stepId
// join wet where wet.ElementId == wt2.ElementId
outer join user where user.id == wt2.User
outer join user2 where user2.id==wtw.ToUser
{
txt ='';
if (wt2.TrackingType == WorkflowTrackingType::Approval)
{
txt = strFmt("%1 : %2 Approved on %3 ", wst.Name, User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Delegation)
{
txt =strFmt("%1 : %2 Delegated to %3 on %4",wst.Name,User.name,user2.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Rejection)
{
txt = strFmt("%1 : %2 Rejected on %3",wst.Name, User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Creation)
{
txt =strFmt("%1 : Assigned to user: %2 on %3",wst.Name, User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Submission)
{
txt = strFmt("Submitted by : %1 on %2", User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2", txt, wtct.Comment);
}
//info(txt);
}
if(first)
{
ret = txt;
first = false;
}
else
{
ret = ret + '\n' + txt;
}
}
return ret;
}
private str getworkflowTrackmessage(WorkflowInstanceNumber _instanceNumber)
{
WORKFLOWTRACKINGSTATUSTABLE w;
WORKFLOWTRACKINGTABLE wt ;
WORKFLOWTRACKINGTABLE wt2;
workflowsteptable wst;
workflowElementtable wet;
workflowTrackingWorkItem wtw;
UserInfo user;
UserInfo user2;
str txt,ret;
workflowtrackingcommenttable wtct;
boolean first=true;
while select * from w ORDER BY wt2.CREATEDdATEtIME ASC
where w.instANCEnUMBER==_instanceNumber//'INS2380404'//INS2383500'//
join wt2 where w.recId == wt2.workflowTrackingStatusTable && wt2.USER!='axwfexec'
join wtct where wt2.RecId==wtct.WorkflowTrackingTable
outer join wtw where wt2.recId==wtw.workflowTrackingTable
outer join wst where wst.stepId == wt2.stepId
// join wet where wet.ElementId == wt2.ElementId
outer join user where user.id == wt2.User
outer join user2 where user2.id==wtw.ToUser
{
txt ='';
if (wt2.TrackingType == WorkflowTrackingType::Approval)
{
txt = strFmt("%1 : %2 Approved on %3 ", wst.Name, User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Delegation)
{
txt =strFmt("%1 : %2 Delegated to %3 on %4",wst.Name,User.name,user2.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Rejection)
{
txt = strFmt("%1 : %2 Rejected on %3",wst.Name, User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Creation)
{
txt =strFmt("%1 : Assigned to user: %2 on %3",wst.Name, User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2",txt, wtct.Comment);
}
//info(txt);
}
if (wt2.TrackingType == WorkflowTrackingType::Submission)
{
txt = strFmt("Submitted by : %1 on %2", User.name,wt2.createdDateTime);
if (wtct.Comment != strMin())
{
txt = strFmt("%1 ,Comments: %2", txt, wtct.Comment);
}
//info(txt);
}
if(first)
{
ret = txt;
first = false;
}
else
{
ret = ret + '\n' + txt;
}
}
return ret;
}
No comments:
Post a Comment