web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Tajwal's Blog / Completed purchase requisit...

Completed purchase requisition workflow history

Community Member Profile Picture Community Member

there was request from end user department once purchase requisition is approved,then they wants  workflow history be printed on purchase requisition report.

below is the code where passing purchase requisition Id it will get purchase requisition workflow history and displaying it on purchase requisition report .

 

static wfHistory PRTrackingStep(PurchReqId _PurchReqId)
{
WorkflowTrackingTable TrackingTable;
WorkflowTrackingStatusTable TrackingStatusTable;
WorkflowStepTable StepTable;
PurchReqTable PurchReqTable;
str Rec,wfStatus=”Approved”;
;
WHILE select PurchReqId,PurchReqName from PurchReqTable
Join User,ToUser from TrackingTable
where PurchreqTable.PurchReqId == _PurchReqId
&& PurchReqTable.dataAreaId == ‘ETIS’
&& PurchReqTable.RecId == TrackingTable.ContextRecId
&& PurchReqTable.TableId == TrackingTable.ContextTableId
&& TrackingTable.ContextTableId == 1551
&& TrackingTable.TrackingType == WorkflowTrackingType::Approval
join * from StepTable
where StepTable.StepId == TrackingTable.StepId
// && StepTable.Name == _Step
join * from TrackingStatusTable
where
TrackingTable.CorrelationId == TrackingStatusTable.CorrelationId
{
if(TrackingTable.TrackingType == WorkflowTrackingType::AutomaticDelegation)
{
if(trackingStatusTable.TrackingStatus == WorkflowTrackingStatus::Completed)
{
Rec += (strfmt(“Delegated To : %1, Step : %2, Status : %3″,EmplTable::find(EmplTable::userId2EmplId(TrackingTable.User)).name(),
StepTable.Name,
wfStatus)) +’\n';
}
else
{
Rec += (strfmt(“Delegated To : %1, Step : %2, Status : %3″,EmplTable::find(EmplTable::userId2EmplId(TrackingTable.User)).name(),
StepTable.Name,
TrackingStatusTable.TrackingStatus)) +’\n';
}
}
else
{
IF(STEPtABLE.Name)
{
if(trackingStatusTable.TrackingStatus == WorkflowTrackingStatus::Completed)
{
Rec += (strfmt(“Assign To : %1, Step : %2, Status : %3″,EmplTable::find(EmplTable::userId2EmplId(TrackingTable.User)).name(),
StepTable.Name,
wfStatus)) +’\n';
}
else
{
Rec += (strfmt(“Assign To : %1, Step : %2, Status : %3″,EmplTable::find(EmplTable::userId2EmplId(TrackingTable.User)).name(),
StepTable.Name,
TrackingStatusTable.TrackingStatus)) +’\n';
}
}
else
{
Rec = “”;
}
}
}
return Rec;

}

 

 


Filed under: Dynamics AX 2009

This was originally posted here.

Comments

*This post is locked for comments