Creating default accounts using main accounts.

Creating default accounts using main accounts.

To obtain the default account for a specific main account, you need the dimension combination base. You can utilize the following standard method: You can use this standard method,

dimCombBase     = LedgerDefaultAccountHelper::getDefaultAccountFromMainAccountRecId(mainAccount);        

Create a DimensionAttributeValueCombination Record: This record should be created as?LedgerDimensionType::DefaultAccount.

Create a DimensionAttributeValueCombination Record: This record should be created as LedgerDimensionType::DefaultAccount.

dimAttValueComb = DimensionAttributeValueCombination::find(dimCombBase);        

Supporting method,

public RecId createDefaultAccount(MainAccountNum _mainAccount)
{
    DimensionAttributeValueCombination  dimAttValueComb;
    DimensionCombinationBase            dimCombBase;
    RecId                               mainAccount;

    mainAccount     = MainAccount::findByMainAccountId(_mainAccount).RecId;

    dimCombBase     = LedgerDefaultAccountHelper::getDefaultAccountFromMainAccountRecId(mainAccount);

    dimAttValueComb = DimensionAttributeValueCombination::find(dimCombBase);

    return dimAttValueComb.RecId;
}        

Feel free to reach out if you have any questions or need further insights on D365 FO!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了