Hi all,
I am trying to print/info the legal entity that a Workers Employment is belonging to.
Am struggling to get the desired answer.
Have tired the following and other which ways.
any help appreciated.
static void getWorkerProject(Args _args)
{
HcmEmployment hcmEmployment;
HcmEmployment hcmEmp;
DimensionAttributeValueSetItem setItem;
DimensionAttributeValue dimAttrValue;
DimensionAttribute dimAttribute;
CompanyInfo ci;
HcmWorker w;
;
dimAttribute = DimensionAttribute::findByName('Project');
//w = HcmEmployment::findByWorkerLegalEntity(
while select crossCompany hcmEmployment
join RecId, DisplayValue from setItem
where setItem.DimensionAttributeValueSet ==
hcmEmployment.DefaultDimension
join dimAttrValue
where dimAttrValue.RecId == setItem.DimensionAttributeValue &&
dimAttrValue.DimensionAttribute == dimAttribute.RecId &&
dimAttrValue.IsDeleted == false
{
//hcmEmp = HcmEmployment::findByWorkerLegalEntity(HcmWorker::find(hcmEmployment.Worker).RecId,hcmEmployment.LegalEntity);
info(strFmt("Employee = %1 %2 = %3 %4 %5 %6 %7",
HcmWorker::find(hcmEmployment.Worker).PersonnelNumber
,dimAttribute.Name
,setItem.DisplayValue
,CompanyInfo::findDataArea(hcmEmployment.dataAreaId).company()
,hcmEmployment.LegalEntity
,hcmEmployment.dataAreaId
,CompanyInfo::findDataArea(hcmEmployment.dataAreaId).Name ));
}
}