Monday, September 30, 2013

Adding Custom Dimension Values to the Custom Dimension using X++ Programming

static void AddingDimensionValuesForCustomDimension(Args _args)
{
    DimensionAttribute              dimensionAttribute;
    DimensionFinancialTag           dimensionFinancialTag;
    DimensionAttributeDirCategory   dimAttributeDirCategory;
    int64                           dirCategory;
    ;

    dimensionAttribute = dimensionAttribute::findByName("CUSTOMCOSTCENTER");// Custom Dimension
    // Only user defined dimensions will have a financial tag category
    if (dimensionAttribute.Type == DimensionAttributeType::CustomList)
    {
        select firstonly DirCategory from dimAttributeDirCategory where dimAttributeDirCategory.DimensionAttribute == dimensionAttribute.RecId;
         dirCategory = dimAttributeDirCategory.DirCategory;
    }
    DimensionFinancialTag.Value = "1000";//Custom Dimension Value
    DimensionFinancialTag.Description = "test"; // Custom Dimension Description
    DimensionFinancialTag.FinancialTagCategory = dirCategory;
    DimensionFinancialTag.insert();
}

No comments:

Post a Comment