Friday, April 23, 2021

Get main account from ledger dimension in D365FO

 In this article, you will get the one line code to get the Main Account from Ledger Dimension using LedgerDimensionFacade class. See the following code:

//Get MainAccountId from LedgerDimension
//The argument (LedgerDimensionValue) is LedgerDimension which you can get from table or any other source as per your requirement
info(strFmt("%1",LedgerDimensionFacade::getMainAccountFromLedgerDimension(LedgerDimensionValue).MainAccountId));

//Get Name of MainAccountId from LedgerDimension
//The argument (LedgerDimensionValue) is LedgerDimension which you can get from table or any other source as per your requirement
info(strFmt("%1",LedgerDimensionFacade::getMainAccountFromLedgerDimension(LedgerDimensionValue).Name));
                            

No comments:

Post a Comment