Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Main Account, Accounts Category

(0) ShareShare
ReportReport
Posted on by 2,055

HI,

I am using AX CU7. I need to get account category of any given main account Id. I am trying with the following code but its not working. Please give me suggestion/solution for this problem.

Thanks

MainAccount::findByMainAccountId("3715101021000").accountCategory()

*This post is locked for comments

  • Nadeem Bhatti Profile Picture
    Nadeem Bhatti 2,055 on at
    RE: Main Account, Accounts Category

    Hi Bhasker,

    Actually your line of code have extra "::" after findAccountCategoryRef that's why its was not working. I have remove it now  its working.

    MainAccountCategory::findAccountCategoryRef::(MainAccount::findByMainAccountId("9012131001000").AccountCategoryRef).accountcategory

  • 5400 Profile Picture
    5400 7,162 on at
    RE: Main Account, Accounts Category

    Hi Nadeem,

    If you want to fetch the accountCategory with respect to main account only why above code is required. above method is edit method, you have to pass accountcategory for same, but u have only main account Id. is it not.

    My find method should work, if you have only mainAccount with correct COA.

    How it will not work, it is bit difficult to understand. :)

  • Nadeem Bhatti Profile Picture
    Nadeem Bhatti 2,055 on at
    RE: Main Account, Accounts Category

    Hi Bhaskar,

    Thanks for your response, I have check but its not working. However I have try with following, this line is working but for not all the Main Accounts.  When I check this line in a job for the Main Account Id which is not working in a loop then its worked fine . I am trying to dig out the problem.

    MainAccount aC;

    MainAccount::findByMainAccountId(cashFlowTmp.AccId).accountCategory(false, aC);

  • 5400 Profile Picture
    5400 7,162 on at
    RE: Main Account, Accounts Category

    Did you check.

  • Verified answer
    5400 Profile Picture
    5400 7,162 on at
    RE: Main Account, Accounts Category

    MainAccountCategory::findAccountCategoryRef::(MainAccount::findByMainAccountId("3715101021000").AccountCategoryRef).accountcategory

    Make sure your main account belongs to current COA.

  • 5400 Profile Picture
    5400 7,162 on at
    RE: Main Account, Accounts Category

    It is accountcategoryRef field itself in mainAccounttable,

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,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans