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

Community site session details

Session Id :
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

I have the same question (0)
  • 5400 Profile Picture
    7,162 on at
    RE: Main Account, Accounts Category

    It is accountcategoryRef field itself in mainAccounttable,

  • Verified answer
    5400 Profile Picture
    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
    7,162 on at
    RE: Main Account, Accounts Category

    Did you check.

  • Nadeem Bhatti Profile Picture
    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
    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
    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

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
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans