Dynamics AX 2012 Inserting Data in Resource Dimension And fetching default Dimension
DimensionDefault getDimension(ResourceTable _Resource)
{
DimensionAttribute DimensionAttribute;
DimensionFinancialTag DimensionFinancialTag;
Struct struct = new Struct();
container defaultDimensionCon;
DimensionDefault workerDimensionDefault;
;
DimensionAttribute =
DimensionAttribute::findByName('Resource');
DimensionFinancialTag =
DimensionFinancialTag::findByFinancialTagCategoryAndValue(DimensionAttribute.financialTagCategory(),_Resource.value,true);
if(!DimensionFinancialTag)
{
DimensionFinancialTag.clear();
DimensionFinancialTag.Description=_Resource.description;
DimensionFinancialTag.Value=_HcmWorker.PersonnelNumber;
DimensionFinancialTag.FinancialTagCategory=DimensionAttribute.financialTagCategory();
DimensionFinancialTag.insert();
struct.add('Resource', _HcmWorker.PersonnelNumber);
defaultDimensionCon += struct.fields();
defaultDimensionCon += struct.fieldName(1);
defaultDimensionCon += struct.valueIndex(1);
workerDimensionDefault =
AxdDimensionUtil::getDimensionAttributeValueSetId(defaultDimensionCon);
return workerDimensionDefault;
}
else
return 0;
}
No comments:
Post a Comment