web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
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

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi Erick Domínguez,

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

  • Suggested answer
    edominguez Profile Picture
    10 on at

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans