Skip to main content

Posts

Showing posts with the label Dimensions

Resolve Budget dimension through X++ [D365FO]

This one is to resolve budget dimensions. Be careful here to use the right class. Budget plan and Budget register use a different contract class. public static void getBudgetLedgerDimension() { //use BudgetPlanningContract for Budget plan //use BudgetAccountContract for Budget register BudgetAccountContract budgetAccountContract = new BudgetAccountContract(); budgetAccountContract.parmValues(new List(Types::Class)); budgetAccountContract.parmAccountStructure('Manufacturing P&L'); DimensionAttributeValueContract attributeValueContract; //Main account attributeValueContract = DimensionAttributeValueContract::construct('MainAccount', '110180'); budgetAccountContract.parmValues().addEnd(attributeValueContract); //Dimension 1 - repeat this for all other dimensions attributeValueContract = DimensionAttributeValueContract::construct('Departmen...

Resolve default dimension through X++ [D365FO]

This one is resolving the Default dimension public static void getDefaultDimension() { DimensionNameValueListContract dimensionNameValueListContract = new DimensionNameValueListContract(); dimensionNameValueListContract.parmValues(new List(Types::Class)); DimensionAttributeValueContract dimensionAttributeValueContract; //Dimension 1 - repeat this for all other dimensions dimensionAttributeValueContract = DimensionAttributeValueContract::construct('Department', '022'); dimensionNameValueListContract.parmValues().addEnd(dimensionAttributeValueContract); //resolve the dimension DimensionNameValueListServiceProvider dimensionNameValueListServiceProvider = DimensionNameValueListServiceProvider::newForDimensionNameValueListContract(dimensionNameValueListContract); DimensionStorageResult dimensionStorageResult = dimensionNameValueListServiceProvider.resolve(); if (dime...

Resolve ledger dimension through X++ [D365FO]

A bit of code to show how to resolve ledger dimensions. There are various codes out there but I thought I would write it in an easy way to understand. It is hard code but I did that for illustration purposes. public static void getLedgerDimension() { DimensionAttribute dimensionAttribute; DimensionAttributeValue dimensionAttributeValue; DimensionSetSegmentName dimensionSet; DimensionStorage dimStorage; LedgerAccountContract ledgerAccountContract = new LedgerAccountContract(); ledgerAccountContract.parmValues(new List(Types::Class)); ledgerAccountContract.parmAccountStructure('Manufacturing B/S'); DimensionAttributeValueContract dimensionAttributeValueContract; //Main account ledgerAccountContract.parmMainAccount('110180'); //Dimension 1 - repeat this for all other dimensions dimensionAttributeValueContract = DimensionAttributeValueContra...