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)

Opening project invoice proposal takes 50 sec

(0) ShareShare
ReportReport
Posted on by 245

Go to Project Management and Accounting -> Common -> Project Invoices -> project invoice proposals

When I double click to open an invoice proposal (any of the proposals listed), it takes ~50 sec.  Below is the query, it's returning the contents of the entire table:

SELECT T1.PROJINVOICEPROJID,
... ...
FROM PROJPROPOSALJOUR T1 LEFT OUTER JOIN DAT1SERVICEORDERPROPOSALUNION T2 ON (((T2.PARTITION=5637144576) AND (T2.DATAAREAID=N'xxx')) AND (T1.PROPOSALID=T2.PROPOSALID)) LEFT OUTER JOIN PROJFUNDINGSOURCE T3 ON (((T3.PARTITION=5637144576) AND (T3.DATAAREAID=N'xxx')) AND ((T1.FUNDINGSOURCE=T3.RECID) AND (T1.FUNDINGSOURCE=T3.RECID))) LEFT OUTER JOIN FISCALESTABLISHMENT_BR T4 ON (((T4.PARTITION=5637144576) AND (T4.DATAAREAID=N'xxx')) AND (T1.FISCALESTABLISHMENT_BR=T4.RECID)) LEFT OUTER JOIN FISCALDOCUMENTTYPE_BR T5 ON (((T5.PARTITION=5637144576) AND (T5.DATAAREAID=N'xxx')) AND (T1.FISCALDOCUMENTTYPE_BR=T5.RECID)) WHERE (((T1.PARTITION=5637144576) AND (T1.DATAAREAID=N'xxx')) AND (T1.RECID<?)) ORDER BY T1.RECID DESC OPTION(FAST 6)

However If in the list of invoice proposals, I first do some filtering by putting the exact proposal i'm looking for, so that the grid has only a single proposal listed, then opening the invoice proposal is much faster, completing in under a sec, because the following is added to WHERE clause:  (T1.PROPOSALID=@P1), thus querying for just a single invoice proposal.

Is it a practice to filter first before doing any selection, or is this something caused by custom code?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Hi pnwguy,

    It's a well-known issue, please refer to this blog post for details instructorbrandon.com/case-of-the-slow-customer-and-sales-order-forms-in-dynamics-ax-plus-functional-hack

  • Verified answer
    KCDeVoe Profile Picture
    1,450 on at

    ievgen is correct. The code in his link is something I put together while working with Brandon. The code is a bit out of date and needed to be changed but we have used it on several forms.

    This is the general idea in the Data Source init:

    if(element.args().dataset() == tableNum(PurchTable))
    {
        if(element.args().callerFormControl() && 
                element.args().callerFormControl().name() != 'NewPurchOrder')//Don't do this if it's a new order. Probably could be better logic.
        {
            purchTableLoc = element.args().record();        
            purchTable_ds.query().dataSourceTable(tableNum(PurchTable)).addRange(fieldNum(PurchTable, PurchId)).value(purchTableLoc.purchId);
        }
    }


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