Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

How to create a LedgerDimension on Dynamics 365 FO, knowing the Default Dimension (DimensionAttributeValueSet.recId) and the MainAccount (value or MainAccount.Recid)

Posted on by 10

Hi, I am migrating a couple of classes using Dynamics 365 FO (Application version: 7.3 Platform version: update 12). But I got stuck with an important piece of code, even when I already tried different solutions answered on different posts in this community related with the class AxdDimensionUtil.

 

What Am I trying to do?

I am trying to create a new "LedgerDimension" and set it in the LedgerJournalTrans.LedgerDimension field while I create a new record of the LedgerJournalTrans Table. This new LedgerDimension must be created from a MainAccount and using the DimensionCombination of an offsetLedgerDimension (without its MainAccount).

OffsetLedgerDimension.png

 

Background

In Dynamics AX 2012 R3 the solution was simple using the AXdDimensionUtil class and the method getLedgerAccountId(), but now in Dynamics 365 this class is obsolete.

My original code in Dynamics 2012 was:

container01 = AxdDimensionUtil::getLedgerAccountValue(offsetLedgerDimension); // get a LedgerDimension in a container
container02 = AxdDimensionUtil::getLedgerAccountValue(ledgerDimensionAccount); // get the main account
container01 = conPoke(container01, 2, conPeek(container02, 2)); // substitute de main account in the original LedgerDimension

ledgerJournalTrans.LedgerDimension = AxdDimensionUtil::getLedgerAccountId(container01); // create the new LedgerDimension


Today 

In Dynamics 365... I used the LedgerDimensionFacade class and... 

I could obtain the RecId of the MainAccount contained in a LedgerDimensionAccount field using the following method and returning a MainAccount.RecId :

LedgerDimensionFacade::getMainAccountIdFromLedgerDimension( LedgerDimensionAccount )  );


and the RecId of the DimensionCombination contained in the OffsetLedgerDimension using the following method and returning a DimensionAttributeValueSet.RecId :

LedgerDimensionFacade::getDefaultDimensionFromLedgerDimension( OffsetLedgerDimension );

OffsetLedgerDimension-_2D00_-copia.png

So finally, How can I achieve this? Am I complicating myself the way I'm doing it? Do you guys have a solution or example for this? Greetings

  • Suggested answer
    edominguez Profile Picture
    edominguez 10 on at
    RE: How to create a LedgerDimension on Dynamics 365 FO, knowing the Default Dimension (DimensionAttributeValueSet.recId) and the MainAccount (value or MainAccount.Recid)

    Thank you very much Sukrut! It's exactly what I needed and it worked just how you said! Greetings.

  • Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: How to create a LedgerDimension on Dynamics 365 FO, knowing the Default Dimension (DimensionAttributeValueSet.recId) and the MainAccount (value or MainAccount.Recid)

    Hi Erick Domínguez,

    Please follow this blog post www.linkedin.com/.../generate-financial-dimension-ledgerdimension-dynamics-yadav

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans