add the below code in HcmWorker Table method.
public static str getDimensionValue(HcmWorkerRecId _workerRecId,Name _DimensionName,
utcdatetime _asOfDate = DateTimeUtil::utcNow())
{
DimensionAttributeValueSetStorage dimStorage;
str dimValue;
Counter counter;
HcmEmployment hcmEmployment;
RecId _DefaultDimension;
;
select hcmEmployment where
hcmEmployment.Worker == HcmWorker::find(_workerRecId).RecId;
dimStorage = DimensionAttributeValueSetStorage::find(hcmEmployment.DefaultDimension);
for (counter=1 ; counter<= dimStorage.elements(); counter++)
{
if(DimensionAttribute::find(dimStorage.getAttributeByIndex(counter)).Name == _DimensionName)
{
dimValue = dimStorage.getDisplayValueByIndex(counter);
// info(strfmt('%1',dimValue));
}
}
return dimValue;
}
after show make a display method to financial methods.
Idisplay HcmPersonnelNumberId branch( )
{
return HcmWorker::getDimensionValue(HcmWorker::findByPersonnelNumber(this.PersonnelNumber).RecId, 'BRANCH');
}
public static str getDimensionValue(HcmWorkerRecId _workerRecId,Name _DimensionName,
utcdatetime _asOfDate = DateTimeUtil::utcNow())
{
DimensionAttributeValueSetStorage dimStorage;
str dimValue;
Counter counter;
HcmEmployment hcmEmployment;
RecId _DefaultDimension;
;
select hcmEmployment where
hcmEmployment.Worker == HcmWorker::find(_workerRecId).RecId;
dimStorage = DimensionAttributeValueSetStorage::find(hcmEmployment.DefaultDimension);
for (counter=1 ; counter<= dimStorage.elements(); counter++)
{
if(DimensionAttribute::find(dimStorage.getAttributeByIndex(counter)).Name == _DimensionName)
{
dimValue = dimStorage.getDisplayValueByIndex(counter);
// info(strfmt('%1',dimValue));
}
}
return dimValue;
}
after show make a display method to financial methods.
Idisplay HcmPersonnelNumberId branch( )
{
return HcmWorker::getDimensionValue(HcmWorker::findByPersonnelNumber(this.PersonnelNumber).RecId, 'BRANCH');
}