close
  • D365 更改了找尋account num 的方法. AX :  info(strFmt("%1",DimensionStorage::getDynamicAccount(accountNum , enumValue)))
  • Find the account number from business login in D 365.
  • Get the financial dimensions from integration.
  • Create a journal line from above info.



Code to do above is as follows:

DimensionDynamicAccount ledgerAccount;
switch(<AccountType>)
{
case (LedgerJournalACType::Cust) :
ledgerJournalTrans.AccountType = LedgerJournalACType::Cust;
ledgerAccount = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(<AccountNum>, LedgerJournalACType::Cust);
ledgerJournalTrans.LedgerDimension = ledgerAccount;
break;
case (LedgerJournalACType::Ledger) :
ledgerJournalTrans.AccountType = LedgerJournalACType::Ledger;
ledgerAccount = LedgerDefaultAccountHelper::getDefaultAccountFromMainAccountRecId(MainAccount::findByMainAccountId(<AccountNum>).RecId);
if(<DefaultDimensionIntegrationValues string from integration>)
{
DefaultDimensionIntegrationValues ledgerString = <AccountNum> + enum2Str(DimensionParameters::find().DimensionSegmentDelimiter) + <DefaultDimensionIntegrationValues string from integration>;
LedgerAccountDimensionResolver dimResolver = LedgerAccountDimensionResolver::newResolver(ledgerString);
ledgerAccount = dimResolver.resolve();

}
ledgerJournalTrans.LedgerDimension = ledgerAccount;
break;
case (LedgerJournalACType::Vend) :
ledgerJournalTrans.AccountType = LedgerJournalACType::Vend;
ledgerAccount = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(<AccountNum>, LedgerJournalACType::Vend);

ledgerJournalTrans.LedgerDimension = ledgerAccount;
break;
}

you need to replace <AccountNum> with your Account number variable and <DefaultDimensionIntegrationValues string from integration> with your Financial dimension string.

 

---------------------------------------------------------------------------------------------------------------

arrow
arrow
    全站熱搜

    lionlionchopper 發表在 痞客邦 留言(0) 人氣()