WF Tracking by step
Wed Dec 25 2024 15:00:23 GMT+0000 (Coordinated Universal Time)
Saved by @MinaTimo
WorkflowTrackingStatusTable WorkflowTrackingStatusTable;
WorkflowTrackingTable WorkflowTrackingTable, WorkflowTrackingTable2;
WorkflowTrackingCommentTable WorkflowTrackingCommentTable;
WorkflowStepTable WorkflowStepTable;
select WorkflowTrackingStatusTable
order by WorkflowTrackingStatusTable.CreatedDateTime desc
where WorkflowTrackingStatusTable.ContextTableId == NW_CertificationAndQualification.TableId
&& WorkflowTrackingStatusTable.ContextRecId == NW_CertificationAndQualification.RecId;
while select WorkflowTrackingTable
where WorkflowTrackingTable.WorkflowTrackingStatusTable == WorkflowTrackingStatusTable.RecId
//join WorkflowStepTable
//where WorkflowStepTable.RecId == WorkflowTrackingTable.WorkflowStepTable
//&& WorkflowTrackingTable.TrackingContext == WorkflowTrackingContext::Step
// && WorkflowTrackingTable.TrackingType == WorkflowTrackingType::Creation
&& WorkflowTrackingTable.TrackingContext == WorkflowTrackingContext::WorkItem
&& WorkflowTrackingTable.TrackingType == WorkflowTrackingType::Approval
outer join WorkflowTrackingCommentTable
where WorkflowTrackingCommentTable.TrackingId == WorkflowTrackingTable.TrackingId
{
select firstonly WorkflowTrackingTable2
where WorkflowTrackingTable.TrackingContext == WorkflowTrackingContext::Step
&& WorkflowTrackingTable.TrackingType == WorkflowTrackingType::Creation
&& WorkflowTrackingTable2.StepId == WorkflowTrackingTable.StepId;
if(WorkflowTrackingTable2.Name =="Review Stage")
{
NW_CertificationAndQualificationTmp.ReviewStatus = "Approval";
NW_CertificationAndQualificationTmp.ReviewComment = WorkflowTrackingCommentTable.Comment;
NW_CertificationAndQualificationTmp.ReviewDate_ = WorkflowTrackingTable.CreatedDateTime;
}
else if(WorkflowTrackingTable2.Name =="Head of Talent Management Approval Stage")
{
NW_CertificationAndQualificationTmp.TalentStatus = "Approval";
NW_CertificationAndQualificationTmp.TalentComment = WorkflowTrackingCommentTable.Comment;
NW_CertificationAndQualificationTmp.TalentDate_ = WorkflowTrackingTable.CreatedDateTime;
}
else if(WorkflowTrackingTable2.Name =="Head of Human Resources Approval Stage")
{
NW_CertificationAndQualificationTmp.HRStatus = "Approval";
NW_CertificationAndQualificationTmp.HRComment = WorkflowTrackingCommentTable.Comment;
NW_CertificationAndQualificationTmp.HRDate_ = WorkflowTrackingTable.CreatedDateTime;
}
}



Comments