Dynamics 365 F&O upgrade of ‘AxdDimensionUtil::getLedgerAccountId ‘

‘AxdAppDimensionUtil’ class has been deprecated in Dynamics 365 F&O and you can see the following error when trying to use it:

”AxdAppDimensionUtil’ does not designate a class or table’.

Here is how to upgrade ‘getLedgerAccountId’ method of this class to resolve the error related to that. This is not the only method used from the class, but it is frequently used so hopefully, my post will be useful for some people. I made a review of what Microsoft did to their code to see how to resolve it.

Example: Classes/TMSInvoiceApproval.

TMSInvoiceApproval.SetAccounts in AX 2012
MSInvoiceApproval.SetAccounts in Dynamics 365 F&O

What you can see here is that this code:
matchReasonVendAcct =  AxdDimensionUtil::getLedgerAccountId([_matchReason.LedgerAccount, _matchReason.LedgerAccount, 0]);

Become:
LedgerAccountDimensionResolver ledgerAccountDimensionResolver = LedgerAccountDimensionResolver::newResolver(_matchReason.LedgerAccount);
ledgerAccountDimensionResolver.parmDimensionFormat(DimensionAttribute::find(DimensionAttribute::getWellKnownDimensionAttribute(DimensionAttributeType::MainAccount)).Name);
matchReasonVendAcct = ledgerAccountDimensionResolver.resolve();


Other examples that you can check are:

  • \Classes\TMSInvoiceApproval\findOrCreateDynamicDimension
  • \Classes\TMSXMLApportionment_Dimension\readAppEntity
  • \Classes\AxdAdvancedLedgerEntry\getDimensionId

This will help to upgrade your code that is using the deprecated ‘AxdDimensionUtil::getLedgerAccountId(…)’.



Leave a Reply

Your email address will not be published. Required fields are marked *