In D365 for finance things are little bit change and much more organized. In Dynamics Ax 2012, which consider as classic AX. We get ledger dimension with DimensionStorage class
ledgerDim = DimensionStorage::getDynamicAccount(
‘US-001’,
LedgerJournalACType::Cust);//Account
offsetLedgerDim = DimensionStorage::getDynamicAccount(
‘USMF OPER’,
LedgerJournalACType::Bank);//OffsetAccount
In D365 this Microsoft provide LedgerDynamicAccountHelper. Code snippet is here
ledgerDim = LedgerDynamicAccountHelper:
:getDynamicAccountFromAccountNumber(‘US-1001’,
LedgerJournalACType::Cust);
offsetLedgerDim = LedgerDynamicAccountHelper:
:getDynamicAccountFromAccountNumber(
‘USMF OPER’,
LedgerJournalACType::Bank);
Reference http://daxingwitheshant.blogspot.com/2015/04/creating-payment-journal-using-x-in-ax.html