Extract/Create Dimension Master values

Hi,
The below job helps to extract all the values for the specific dimension.

//To extact all the values for a specific dimension (ex: Department)
static void ExtractDimensionValues(Args _args)
{
    DimensionValueService   service         = new DimensionValueService();
    DimensionContract       contract        = new DimensionContract();
    DimensionValueContract  contractValue   = new DimensionValueContract();
    List                    deptDimList;
    ListEnumerator          listEnum;   
    Name                    dimensionName;
    str                         value;
    Description             description;
    ;
   
    //To create new values in the specific dimension
    //contractValue.parmDimensionAttribute('Departments');
    //contractValue.parmValue('HR')
    //contractValue.parmDescription('Human Resources');
    //service.createDimensionValue(contractValue);

    //To get the values for the specific dimension
    contract.parmDimensionName('Departments');
    deptDimList = service.getDimensionValues(contract);
    listEnum = deptDimList.getEnumerator();
    while(listEnum.moveNext())
    {
        contractValue = listEnum.current();
        dimensionName = contractValue.parmDimensionAttribute();
        value         = contractValue.parmValue();
        description   = contractValue.parmDescription();
        info(strFmt('%1~%2~%3',dimensionName, value, description));
    }
}

Comments

Popular posts from this blog

x++ code to Generate cheque for vendor payment journal

Import Procurement Hierarchy / Categories with out code in ax 2012

Copy favorites From one user to another user - Ax 2012