Hi
I’ve this code from create custledgeraccount:
select DimensionAttributeValueCombination index hint mainAccountIdx
where DimensionAttributeValueCombination.DisplayValue == MainAccount.MainAccountId
&& DimensionAttributeValueCombination.LedgerDimensionType == LedgerDimensionType::Account;
if(! DimensionAttributeValueCombination)
select DimensionAttributeValueCombination index hint mainAccountIdx
where DimensionAttributeValueCombination.MainAccount == MainAccount.RecId
&& DimensionAttributeValueCombination.LedgerDimensionType == LedgerDimensionType::DefaultAccount;
if(DimensionAttributeValueCombination.RecId)
{
CustLedgerAccounts.initValue();
custLedgerAccounts.postingProfile = custPostingProfile;
custLedgerAccounts.Num = _custTable.AccountNum;
custLedgerAccounts.SummaryLedgerDimension = DimensionAttributeValueCombination.RecId;
custLedgerAccounts.accountCode = TableGroupAll::Table;
custLedgerAccounts.insert();
}
However when I try to post a sale it gives me an error. If in the posting profile I manually select the ledger account, the problem is solved. How can I create the posting profile correctly?
Thanks