Worker details using x++
Worker Name, Department Name, Reports to:
HcmWorker hcmWorker;
HcmPosition hcmPosition;
HcmJob hcmJob;
HcmPositionWorkerAssignment hcmPositionWorkerAssignment;
HCmPositionHierarchy hcmPositionHierarchy;
select firstonly hcmWorker where hcmWorker.personnelNumber == '';
hcmWorker.name())); // worker Name
info(strfmt('Department Name :%1',hcmWorker.primaryDepartmentName(); // department name
select * from hcmPositionWorkerAssignment where hcmPositionWorkerAssignment.Worker == hcmWorker.RecId;
info(strfmt('Start date :%1', DateTimeUtil::date(hcmPositionWorkerAssignment.ValidFrom))); // Start date
select * from hcmPosition where hcmPosition.RecId == hcmPositionWorkerAssignment.Position;
info(strfmt('Position name :%1', hcmPositionDetail::find(hcmPosition.RecId).Description)); // Position Name
hcmJob = hcmJob::find(hcmPositionDetail::find(hcmPosition.RecId).Job);
info(strfmt('Job Level :%1', hcmJob.JobId)); // Job level
select * from hcmPositionHierarchy where hcmPositionHierarchy.Position == hcmPosition.RecId;
hcmPosition = HcmPosition::find(hcmPositionHierarchy.ParentPosition);
select * from hcmPositionWorkerAssignment where hcmPositionWorkerAssignment.Position == hcmPosition.RecId;
info(strfmt('Reports To :%1',HcmWorker::find(hcmPositionWorkerAssignment.Worker).name()));// Reports toFirst name, Last name, Birth date:
HcmWorker hcmWorker; DirPerson dirPerson; DirPersonName dirPersonName; HcmEmployment hcmemployment; CompanyInfo companyInfo; HcmPersonPrivateDetails hcmPersonPrivateDetails; select hcmemployment order by hcmemployment.legalEntity join hcmworker where hcmworker.RecId == hcmemployment.Worker join companyInfo where companyInfo.RecId == hcmemployment.legalEntity && companyInfo.DataArea == ''; // FirstName, LastName select firstonly FirstName, LastName from dirPersonName where dirPersonName.person == hcmworker.person; //BirthDate select firstonly BirthDate from hcmPersonPrivateDetails where hcmPersonPrivateDetails.person == hcmworker.person; //DimensionName DefaultDimensionView defaultDimensionView; select firstonly DisplayValue from defaultDimensionView where defaultDimensionView.Name == 'dimensionName' && defaultDimensionView.DefaultDimension == hcmemployment.defaultDimension; return defaultDimensionView.DisplayValue;
Keep Daxing!!
No comments:
Post a Comment