Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

(0) ShareShare
ReportReport
Posted on by 1,879

Hello everyone,

How can I get the LedgerDimensionField Values from GeneralJournalAccountEntry table ? I need individual values from that field. Please advice any example.

ledg.jpg

Thank you.

  • Faqruddin Profile Picture
    Faqruddin 1,879 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    No. But below code works. Thank you for your prompt response.

    MainAccount::findByLedgerDimension(LedgerDimension).MainAccountId;

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    Did you do an incremental CIL after changing your code?

  • Faqruddin Profile Picture
    Faqruddin 1,879 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    Please check below output.

    ledg1.jpg

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    In that case, try this statement -

    DimensionStorage::GetMainAccountFromLedgerDimension(generalJournalAccountEntry.LedgerDimension).MainAccountId;

  • Faqruddin Profile Picture
    Faqruddin 1,879 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    All above methods bring RecId vlaue of the record. Even the DimensionAttributeValueCombination.

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    getMainAccountFromLedgerDimension method will return the the MainAccount record. getMainAccountNumFromLedgerDimension method should return the MainAccount Id. What values are you getting when you used these methods?

    Could you query DimensionAttributeValueCombination table using the same LedgerDimension value and check the value of the MainAccount field?

    DimensionAttributeValueCombination  dimAttrValueCombo;
        
    
    select firstonly MainAccount from dimAttrValueCombo where dimAttrValueCombo.RecId == generalJournalAccountEntry.LedgerDimension

  • Faqruddin Profile Picture
    Faqruddin 1,879 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    I try All below methods. Still same. Its not getting MainAccountNum.

    getMainAccountFromLedgerDimension

    getMainAccountIdFromLedgerDimension

    getMainAccountNumFromLedgerDimension

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    Try this please. Really difficult to find all the methods used in AX 2012

    display RecId displayMainAccountid()
    {
    
        return DimensionStorage::GetMainAccountNumFromLedgerDimension(this.LedgerDimension);
    
    }

  • Faqruddin Profile Picture
    Faqruddin 1,879 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    Its Ok to have mistakes . The above method is getting RecId value only not MainAccountNum.

    display RecId displayMainAccountid()
    {
    
        return DimensionStorage::GetMainAccountIdFromLedgerDimension(this.LedgerDimension);
    
     }
     

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

    My mistake. This class is used in D365 only and not AX 2012. You can use this statement to get Main account

    DimensionStorage::GetMainAccountIdFromLedgerDimension(generalJournalAccountEntry.LedgerDimension)

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans