web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Function DimensionValidationRequest::newForLedgerDimensionType has been incorrectly called.

(0) ShareShare
ReportReport
Posted on by 552

Hi guys,

I'm creating payment journal using X , initially it was fine and had been ran successfully (able to post via x ) for few days, but just recently (today) I got this error which I'm not sure what happened : 

Function DimensionValidationRequest::newForLedgerDimensionType has been incorrectly called.

My code is as simple as like this : 

ledgerjournalname = LedgerJournalName::find(CustParameters::find().TEST_CustomerPaymentJourName);

ledgerjournaltable.JournalName = ledgerjournalname.JournalName;
ledgerjournalTable.initFromLedgerJournalName();

ledgerjournalTable.JournalNum = JournalTableData::newTable(ledgerjournalTable).nextJournalId();
ledgerJournalTable.Name       = strFmt("Payment on %1.", today());
ledgerjournalTable.insert();

While select....
{
    ttsbegin;
    NumberSeq                       numberSeqTransVoucher;
                        
    CustTable                       custTable = CustTable::find(receiptGroupTmpSelect.CustAccount);
    RetailTransactionTable          retailTable = RetailTransactionTable::findReceiptId(MyTable.receiptId);
    container                       txtReceiptIds;
    ledgerjournalTrans.JournalNum       = ledgerjournalTable.JournalNum;
    numberSeqTransVoucher               = NumberSeq::newGetVoucherFromId((ledgerjournalname.NumberSequenceTable));
    ledgerJournalTrans.TransDate        = MyTable.TransDate;
    LedgerJournalTrans.Company          = curExt();
    ledgerjournalTrans.Voucher          = numberSeqTransVoucher.voucher();
    ledgerjournalTrans.TransactionType  = LedgerTransType::Payment;
    ledgerjournalTrans.AccountType      = LedgerJournalACType::Cust;
    ledgerJournalTrans.LedgerDimension  = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(custTable.AccountNum,LedgerJournalACType::Cust);
    ledgerJournalTrans.DefaultDimension = retailTable.DefaultDimension;
    ledgerjournalTrans.parmAccount(custTable.AccountNum,ledgerjournalTrans.AccountType);
    ledgerJournalTrans.postingProfile   =  CustParameters::find().PostingProfile;

    ledgerJournalTrans.Txt              = MyTable.Txt;
    LedgerJournalTrans.PaymReference    = MyTable.PaymReference;
            
    ledgerjournalTrans.CurrencyCode     = retailTable.currency;
                                
    txtReceiptIds                            = [receiptInvPayMatchMasterGroupbyReceipt.ReceiptId];
    ledgerJournalTrans.ExchRate             =  CurrencyExchangeHelper::newExchangeDate(Ledger::current(),
                                                              receiptGroupTmpSelect.transDate).                                                                                                               calculateCurrencyToCurrency(ledgerjournalTrans.CurrencyCode,
                                                 Ledger::accountingCurrencyByLedger(Ledger::current()), MyTable.paymentAmount,true);
                                
    ledgerJournalTrans.PaymMode                 =  MyTable.CustPaymMode;
    ledgerJournalTrans.modifiedField(fieldNum(LedgerJournalTrans,PaymMode));
    ledgerJournalTrans.OffsetAccountType        =  MyTable.OffsetAccountType;
    ledgerjournaltrans.OffsetCompany            =  curExt();
    ledgerjournalTrans.OffsetLedgerDimension    =  CustPaymModeTable::find(ledgerJournalTrans.PaymMode).PaymentLedgerDimension;
    ledgerJournalTrans.modifiedField(fieldNum(LedgerJournalTrans,OffsetLedgerDimension));
                                
    ledgerJournalTrans.insert();

}


LedgerjournalCheckPost      LedgerjournalCheckPost;
LedgerjournalCheckPost      =   LedgerjournalCheckPost::newLedgerJournalTable(LedgerjournalTable,NoYes::Yes);
LedgerjournalCheckPost.run();

Someone mentioned about Account structure changed, but there is no changes and currently is Active.

Thanks

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    Hi Ken,

    As the function is not used in your custom coding, I would suggest using the debugger to find the culprit. It might be data related.

  • Ken Manhattan Profile Picture
    552 on at

    Yes, actually I did, however this posting process  (LedgerjournalCheckPost) contain so many function and many classes call each other, which I get lost so many time when doing it.

    So the reason I'm post in here probably someone have face this before and can point me to the right place.

    Anyway I will keep debugging.

    Thanks

  • Ken Manhattan Profile Picture
    552 on at

    What really confuse me is the mentioned function, not even call when I debug. I have put the break point in DimensionValidationRequest void newForLedgerDimensionType, but not reach there.

    pastedimage1681892853852v1.png

    it is not to this and I can't find where in LedgerJournalCheckPost call this then error.

    What I can find so far is in LedgerJournalCheckPost - RunInternal, it will goes to CatchError, ->

    pastedimage1681893010317v2.png

    Right after running this statement : [postingSuccess, intercompanyPostingSuccess] = this.postJournal();

    But the postJournal actually return True for both, means no problem ?

    pastedimage1681894074808v4.png

    Thanks

  • Ken Manhattan Profile Picture
    552 on at

    Now I'm thinking whether there is something not right on the way I make the payment journal ?

    Is there something I missed ? or something not in order ?

    I look at some blogs, but since everything and everyone has its own way of doing it, I'm more confuse then ever.

    Anyone can help me on this ?

    Thanks,

  • André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    Hi Ken,

    Have you enabled the option to debug in other models? You can enable more models via the options settings in the Dynamics 365 add-in.

  • Ken Manhattan Profile Picture
    552 on at

    I've remove the line for assigning PaymentLedgerDimension ->

    ledgerjournalTrans.OffsetLedgerDimension    =  CustPaymModeTable::find(ledgerJournalTrans.PaymMode).PaymentLedgerDimension;

    and the error is gone. It looks like doesn't need to assign "manually", then the standard code will assign it, based on the account type.

    But there is another thing though, about the Offset default dimension. I am wondering since I didn't "manually" assign the OffsetLedgerDimension it self, how am I going to assign Offset Default Dimension ? And as this is based on account type, how to correctly get the default dimension of it (for example if bank, then the bank default dimension, if account then account default dimension)

    Thanks,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans