To get financial dimension value from worker position, add a new method in hcmWorker Table with script like below:

public static str getDimensionValue
          (HcmWorkerRecId _workerRecId, 
           Name _DimensionName, 
           utcdatetime _asOfDate = DateTimeUtil::utcNow())
{
    DimensionAttributeValueSetStorage             dimStorage;
    str                                                             dimValue;
    Counter                                                     Counter;
    HcmPositionDefaultDimension                    _HcmPositionDefaultDimension;
    RecId                                                       _DefaultDimension;
    ;
    select _HcmPositionDefaultDimension where
    _HcmPositionDefaultDimension.Position == HcmWorker::getPrimaryPosition(_workerRecId);
    dimStorage = DimensionAttributeValueSetStorage::find
                         (_HcmPositionDefaultDimension.DefaultDimension);
    for (Counter=1 ; Counter<= dimStorage.elements() ; Counter++)
    {
         if(DimensionAttribute::find(dimStorage.getAttributeByIndex(Counter)).Name == _DimensionName)
         {
               dimValue = dimStorage.getDisplayValueByIndex(Counter);
         }
    }
    return dimValue;
}

After it, if we wanna make display method to show financial dimension, we can use method above. In example we wanna display dimension site from a worker who have PersonnelNumber = "00001". The script is like below :

display str Site()
{
          return hcmWorker::getDimensionValue(
                    hcmWorker::findByPersonnelNumber("00001").recid, "Site");
}

 

相关文章:

  • 2021-12-01
  • 2021-11-06
  • 2021-11-21
  • 2022-12-23
  • 2021-06-29
  • 2022-03-01
  • 2021-05-22
  • 2021-12-07
猜你喜欢
  • 2022-02-09
  • 2021-08-27
  • 2021-05-31
  • 2022-02-28
  • 2021-12-14
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案