Hi All,
I am trying to create Invoice Journal. My code is working fine except the ledger dimension value. I have used the following method to get the ledger dimension.
_ledgerDimension = LedgerDefaultAccountHelper::getDefaultAccountFromMainAccountRecId(MainAccount::findByMainAccountId(range.get_Item(i, 5).value).RecId);
_ledgerDimension = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(projTable.ProjId, LedgerJournalACType::Project);
These two methods returning the same ledger dimension but when I try to post the voucher it throws the following exception.
When I create Invoice Journal from D365FO front end it uses the different ledger dimension and its working fine while posting. but code get the other one that is not working. Here are the ledger dimensions. 5639948829 is worked fine but my code get the 5637417423 code and it generate error.