First we need to create one new class (named like "WorkflowUserListClass" and copy the following codes.
public class
WorkflowUserListClass
{
// Class
Declaration
public
WorkflowContextTableId workflowOrginTableTableId;
public
WorkflowContextRecId workflowOrginTableRecId;
public
WorkflowContextTableId
parmWorkflowOrginTableTableId(WorkflowContextTableId
_workflowOrginTableTableId = workflowOrginTableTableId)
{
workflowOrginTableTableId = _workflowOrginTableTableId;
return workflowOrginTableTableId;
}
public
WorkflowContextRecId parmWorkflowOrginTableRecId(WorkflowContextRecId
_workflowOrginTableRecId = workflowOrginTableRecId)
{
workflowOrginTableRecId = _workflowOrginTableRecId;
return workflowOrginTableRecId;
}
// This method is used for Approval
workflow users list.
public container
findUserInfoFromWorkflow()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable
workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
SalesTable
saleTable;
HcmWorkerRecId
workerRecId;
HcmWorker hcmWorker;
container
workerRecIdContainer;
while select firstFast RecId, User from workflowTrackingTable
order by RecId asc
join workflowTrackingCommentTable
where
workflowTrackingCommentTable.WorkflowTrackingTable ==
workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where
workflowTrackingTable.WorkflowTrackingStatusTable ==
workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId
== workflowOrginTableRecId
&& workflowTrackingStatus.ContextTableId ==
workflowOrginTableTableId
&& workflowTrackingTable.TrackingType ==
WorkflowTrackingType::Approval
{
workerRecId = HcmWorker::userId2Worker(userInfo.id);
workerRecIdContainer += workerRecId;
}
return workerRecIdContainer;
}
// This method is used to find the workflow
approval dates.
public container
findWorkfFlowDatesFromWorkflow()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable
workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
SalesTable
saleTable;
PurchTable
purchTable;
PurchReqTable
purchReqTable;
HcmWorkerRecId workerRecId;
HcmWorker hcmWorker;
TransDate workflowDate;
container
workerRecIdContainer;
container workerDateContainer;
while select firstFast RecId, User, CreatedDateTime from workflowTrackingTable
order by RecId asc
join workflowTrackingCommentTable
where
workflowTrackingCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where
workflowTrackingTable.WorkflowTrackingStatusTable ==
workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId
== workflowOrginTableRecId
&& workflowTrackingStatus.ContextTableId ==
workflowOrginTableTableId
&& workflowTrackingTable.TrackingType ==
WorkflowTrackingType::Approval
{
//workerRecId = HcmWorker::userId2Worker(userInfo.id);
//workerRecIdContainer += workerRecId;
workflowDate =
DateTimeUtil::date(workflowTrackingTable.CreatedDateTime);
workerDateContainer += workflowDate;
}
return workerDateContainer;
}
// This method is used to find the Position
of the employees.
public
Description findPositionForWorker(HcmWorkerRecId _workerRecId)
{
HcmWorker
hcmWorker;
HcmPositionWorkerAssignment workerAssignment;
HcmPosition
hcmPosition;
HcmPositionDetail hcmPositionDetail;
select recid, person from hcmWorker
join worker, position from workerAssignment
where hcmWorker.RecId == _workerRecId
&& workerAssignment.Worker ==
hcmWorker.RecId
join recid from hcmPosition
where hcmPosition.RecId ==
workerAssignment.Position
join position, description from hcmPositionDetail
where hcmPositionDetail.Position ==
hcmPosition.RecId;
return hcmPositionDetail.Description;
}
public
container findUserInfoFromWorkflowDelegate()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable
workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
HcmWorkerRecId
workerRecId;
HcmWorker hcmWorker;
container
workerRecIdContainer;
while select firstFast RecId, User from workflowTrackingTable
order by RecId asc
join workflowTrackingCommentTable
where
workflowTrackingCommentTable.WorkflowTrackingTable ==
workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where
workflowTrackingTable.WorkflowTrackingStatusTable ==
workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId
== workflowOrginTableRecId
&& workflowTrackingStatus.ContextTableId ==
workflowOrginTableTableId
&& workflowTrackingTable.TrackingType ==
WorkflowTrackingType::Delegation
{
workerRecId = HcmWorker::userId2Worker(userInfo.id);
workerRecIdContainer += workerRecId;
}
return workerRecIdContainer;
}
public
HcmWorkerRecId findUserInfoFromWorkflowSubmission()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable
workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
HcmWorkerRecId
workerRecId;
HcmWorker
hcmWorker;
container
workerRecIdContainer;
select firstFast RecId, User from workflowTrackingTable
order by RecId asc
join workflowTrackingCommentTable
where
workflowTrackingCommentTable.WorkflowTrackingTable ==
workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where
workflowTrackingTable.WorkflowTrackingStatusTable ==
workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId
== workflowOrginTableRecId
&& workflowTrackingStatus.ContextTableId ==
workflowOrginTableTableId
&& workflowTrackingTable.TrackingType ==
WorkflowTrackingType::Submission;
{
workerRecId = HcmWorker::userId2Worker(userInfo.id);
}
return workerRecId;
}
public TransDate
findDateWorkflowSubmission()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable
workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
HcmWorkerRecId
workerRecId;
HcmWorker
hcmWorker;
container
workerRecIdContainer;
TransDate
submissionDate;
select firstFast RecId, User, CreatedDateTime from workflowTrackingTable
order by RecId asc
join workflowTrackingCommentTable
where
workflowTrackingCommentTable.WorkflowTrackingTable ==
workflowTrackingTable.RecId
join UserInfo
where UserInfo.id == WorkflowTrackingTable.User
exists join workflowTrackingStatus
where
workflowTrackingTable.WorkflowTrackingStatusTable ==
workflowTrackingStatus.RecId
&& workflowTrackingStatus.ContextRecId
== workflowOrginTableRecId
&& workflowTrackingStatus.ContextTableId ==
workflowOrginTableTableId
&& workflowTrackingTable.TrackingType ==
WorkflowTrackingType::Submission;
{
submissionDate =
DateTimeUtil::date(workflowTrackingTable.CreatedDateTime);
}
return submissionDate;
}
}
No comments:
Post a Comment