Get ledger dimension from Main account with combination default dimension in ledgers

 Hi Viewers

If you want to get ledger dimension based on only main account. please check below code.


        RecId mainAccountRecId =  MainAccount::findByMainAccountIdAndCOA(mainaccount, LedgerChartOfAccounts::current()).RecId;
        RecId defaultDimension = MainAccountLegalEntity::findByMainAccountLegalEntity(mainAccountRecId, CompanyInfo::find().RecId).DefaultDimension;

        ledgerjournalTrans.LedgerDimension = LedgerDimensionFacade::serviceCreateLedgerDimension(LedgerDefaultAccountHelper::getDefaultAccountFromMainAccountIdAndCOA(mainaccount, LedgerChartOfAccounts::current()), defaultDimension);
        ledgerjournalTrans.DefaultDimension = defaultDimension;

Comments

Popular posts from this blog

Multi select lookup in UI Builder class in D365F&O through x++ code.

In ax D365F&O post packing slip from shipment through code x++.

Custom label layouts and printing In D365 F&O