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 :
Microsoft Dynamics AX (Archived)

AR payment journal validation is very, very slow - Problem code found

(0) ShareShare
ReportReport
Posted on by 3,155

A payment journal with 5 lines can take 20-30 minutes to validate and another 20-30 to post.  I believe that I have found the problem code.

In Classes\LedgerJournalTransUpdateCust\checkSettleVoucher we can find the following 'while select':

while select crossCompany Balance01 from specTrans
where specTrans.SpecCompany == _ledgerJournalTrans.company() &&
specTrans.SpecTableId == _ledgerJournalTrans.TableId &&
specTrans.SpecRecId == _ledgerJournalTrans.RecId
join AmountCur from custTransOpen
where specTrans.RefCompany == custTransOpen.DataAreaId &&
specTrans.RefTableId == custTransOpen.TableId &&
specTrans.RefRecId == custTransOpen.RecId
join RecId, Voucher, AccountNum, Approved, Closed from custTrans
where custTransOpen.RefRecId == custTrans.RecId
join Party from custTransCustomer
where custTrans.AccountNum == custTransCustomer.AccountNum

Now if you take away the 'crosscompany' it runs very quick.  Also if you take away custTransCustomer (CustTable) the query will run very quickly.

So, I believe this might have to do with the fact that we have our Customers set up under a 'Virtual company' so that they exist in ALL entities.

With that in mind, I'm wondering if there is an '&&' we can append to the custTransCustomer to help speed up the query while maintaining the integrity of query and the validation as a whole.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    b_radlyjames Profile Picture
    3,155 on at

    I think the quickest and possibly best solution here is to remove the join on 'custTransCustomer' and do:

    select firstonly Party from custTransCustomer

    where custTransCustomer.AccountNum == custTrans.AccountNum

    This takes a journal that was validating in 20-30 minutes down to less than 10 seconds.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans