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 :
Dynamics 365 Community / Blogs / Dynamics AX training / DimensionStorage::getDefaul...

DimensionStorage::getDefaultAccountForMainAccountNum()

VolodymyrMy Profile Picture VolodymyrMy 686

Hi! I am struggling with Dynamics AX 2012 now. It consume a lot of energy =)
I have fond one issue that should be changed in standard Dynamics AX 2012 (for my point of view).

Different Dynamics AX entities (companies) could have the same name of main accounts.

If it is required to convert main account name to ledger dimension id the DimensionStorage::getDefaultAccountForMainAccountNum() method is used.
This method contains the following code:

select recId from MainAccount where mainAccount.MainAccountId == _mainAccountNum;
return DimensionStorage::getDefaultAccount(mainAccount.RecId);

We can see that where clause doesn’t contain the entity identification. So if different Dynamics AX entities (companies) have same main accounts then “select” returns any of them.
This will lead to different errors because method is not convert main account name to ledger dimension id as assumed.

The select statement should be changed to the following:

select recId from mainAccount
where mainAccount.MainAccountId == _mainAccountNum
join ledger
where ledger.ChartOfAccounts == mainAccount.LedgerChartOfAccounts
join companyInfo
where companyInfo.RecId == ledger.PrimaryForLegalEntity &&
companyInfo.DataArea == curext();

Hope Microsoft team find this topic to check the solution.
All the best

The post DimensionStorage::getDefaultAccountForMainAccountNum() first appeared on Dynamics AX Training.

This was originally posted here.

Comments

*This post is locked for comments