Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

X++ code to get LedgerDimensionField Values from GeneralJournalAccountEntry table

(0) ShareShare
ReportReport
Posted on by 1,871

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,871 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,871 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,871 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,871 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,871 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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,602 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,340 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans