while select workflowTrackingTable order by CreatedDateTime asc
where workflowTrackingTable.CreatedDateTime >= fromDateTimeValue
&& workflowTrackingTable.CreatedDateTime <= toDateTimeValue
{
actionTakenByName = DirPersonUser::userId2Name(workflowTrackingTable.User);//xUserInfo::find(true,workflowTrackingTable.User).name;
select workflowTrackingStatusTable where workflowTrackingStatusTable.RecId == workflowTrackingTable.WorkflowTrackingStatusTable;
select workflowCommentTable where workflowCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId;
select workflowWorkItemTable where workflowWorkItemTable.CorrelationId == workflowTrackingStatusTable.CorrelationId;
if(workflowTrackingStatusTable)
{
ttsbegin;
afzWorkflowInquiryTable.DateTime = workflowTrackingTable.CreatedDateTime;
afzWorkflowInquiryTable.DocumentType = workflowTrackingStatusTable.DocumentType;
afzWorkflowInquiryTable.WorkflowInstance = workflowTrackingStatusTable.InstanceNumber;
afzWorkflowInquiryTable.WorkflowStatus = workflowTrackingStatusTable.TrackingStatus;
afzWorkflowInquiryTable.WorkflowStatusString = enum2Str(workflowTrackingStatusTable.TrackingStatus);
afzWorkflowInquiryTable.SubmittedBy = workflowTrackingStatusTable.getSubmitterUserName();
afzWorkflowInquiryTable.Document = workflowTrackingStatusTable.Document;
if(actionTakenByName)
afzWorkflowInquiryTable.ActionTakenBy = actionTakenByName;
else
afzWorkflowInquiryTable.ActionTakenBy = workflowTrackingTable.User;
afzWorkflowInquiryTable.TrackingType = workflowTrackingTable.TrackingType;
afzWorkflowInquiryTable.Context = workflowTrackingTable.TrackingContext;
afzWorkflowInquiryTable.CompanyName = workflowTrackingStatusTable.ContextCompanyId;
afzWorkflowInquiryTable.Comment = workflowCommentTable.Comment;
afzWorkflowInquiryTable.TrackingMessage = workflowCommentTable.TrackingMessage;
afzWorkflowInquiryTable.Name = workflowTrackingTable.Name;
afzWorkflowInquiryTable.DocumentRecId = workflowTrackingStatusTable.ContextRecId;
afzWorkflowInquiryTable.insert();
ttscommit;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Get only last approver detail: -
select workflowTrackingStatus order by CreatedDateTime desc
where workflowTrackingStatus.ContextTableId == tableNum(purchtable)
&& workflowTrackingStatus.ContextRecId == purchtable.recid
&& workflowTrackingStatus.TrackingStatus == WorkflowTrackingStatus::Completed
join workflowTrackingTable order by CreatedDateTime desc
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId
&& workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval
join userInfo
where userInfo.id == workflowTrackingTable.User;
//_purchaseOrderHeader.User = HcmWorker::findByPerson(DirPersonuser::find(currentUserId).PersonParty).name();
_purchaseOrderHeader.User = UserInfoHelp::userName(workflowTrackingTable.User);
_purchaseOrderHeader.UserPrintedBy = UserInfoHelp::userName(curUserId());
_purchaseOrderHeader.UserOriginator = UserInfoHelp::userName(purchtable.CreatedBy);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
No comments:
Post a Comment