Below is the code snippet to get the Primary Position Title of the employee by passing the worker recid.
private HcmTitleId getPositionTitle(HcmWorkerRecId hcmWorkerRecid)
{
HcmWorker hcmWorker;
HcmPositionWorkerAssignment hcmPositionWorkerAssignment;
HcmPosition hcmPosition;
HcmPositionDetail hcmPositionDetail;
HcmTitle hcmTitle;
hcmPositionWorkerAssignment = HcmWorkerHelper::getWorkerPrimaryPositionAssignment(hcmWorkerRecid);
select TitleId from hcmTitle
join hcmPositionDetail
where hcmPositionDetail.Title == hcmTitle.RecId
join hcmPosition
where hcmPosition.RecId == hcmPositionWorkerAssignment.Position;
return hcmTitle.TitleId;
}
Note that HcmPositionWorkerAssignment is a validTimeState table. The above query will only retrieve position assignment that is currently active.
private HcmTitleId getPositionTitle(HcmWorkerRecId hcmWorkerRecid)
{
HcmWorker hcmWorker;
HcmPositionWorkerAssignment hcmPositionWorkerAssignment;
HcmPosition hcmPosition;
HcmPositionDetail hcmPositionDetail;
HcmTitle hcmTitle;
hcmPositionWorkerAssignment = HcmWorkerHelper::getWorkerPrimaryPositionAssignment(hcmWorkerRecid);
select TitleId from hcmTitle
join hcmPositionDetail
where hcmPositionDetail.Title == hcmTitle.RecId
join hcmPosition
where hcmPosition.RecId == hcmPositionWorkerAssignment.Position;
return hcmTitle.TitleId;
}
Note that HcmPositionWorkerAssignment is a validTimeState table. The above query will only retrieve position assignment that is currently active.
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks,
Zahid
No comments:
Post a Comment