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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

"Query used" defaults

(0) ShareShare
ReportReport
Posted on by 282

Hi all,

Running AX 2012 R3 CU9.

When running confirmations, pick lists, etc - is it possible to change the values within "Query used" defaults?

I'm aware you can save the values in a selection as a separate query but that's reliant on usage data not being deleted, and as far as I know you can't make a custom query the default.

Presumably it must be getting the data for the default ranges from somewhere, is there a way we can slip in a few extra fields in the default "Query used" selection without breaking base classes?

Thanks very much in advance,

Luke

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    "Query used" means the last used query and it's stored in usage data as well.

    Of course, if you run the logic for the very first time, you have the default query without any custom setup. It's up to the particular class how it defines the default query - it can be taken from AOT, built completely in code or anything in between. You can customize it if required.

  • lukbel Profile Picture
    282 on at

    Ah, thank you for the clarification Martin :)

    Do you know where I would be able to find what classes control the default for running a pick slip or a sales confirmation?

    I did have a quick poke around in a few SalesConfirm- classes prior to this but couldn't find anything which looked relevant to this situation.

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    What's the exact dialog you mean? I can think of several things related to packing slips, for instance.

  • lukbel Profile Picture
    282 on at

    The part I was hoping to change was the range of the query - defaulting in a number of values of custom fields we have, see highlighted below:

    23700.Capture.PNG

    Apologies if I misunderstood your question or should have framed it differently

    Thanks,

    Luke

  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    In this case, you have to look at SalesFormLetterParmDataPackingSlip class and its parent, FormLetterParmData.

    For instance, FormLetterParmData.initQueryBuild() has the following implementation:

    protected void initQueryBuild()
    {
        chooseLines = new SysQueryRun(this.queryName());
    }

    If you modified the query defined in SalesFormLetterParmData class (= SalesUpdate query), it would have impact to all form letter postings. But you could build a custom query, override queryName() method in SalesFormLetterParmDataPackingSlip class and return the name of your query there. Or you can override initQueryBuild() and add some ranges in code.

  • lukbel Profile Picture
    282 on at

    Ahh, this makes sense - so the two classes I would need to tweak would be SalesFormLetterParmDataConfirm and SalesFormLetterParmDataPickingList. Thanks a lot for narrowing this down for me!

    However I can't seem to see where in these classes they reference FormLetterParmData.initQueryBuild() or where queryName() is constructed.

    Apologies for taking so long for it to sink in haha

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    initQueryBuild() is called from updateQueryBuild(), which is called from FormLetterParmDataInitialVersion.initQuery(), which is called from FormLetterParmData.initLinesQuery() and so on. Please use cross-references to walk through it statically, or use the debugger to see the actual call stack at runtime.

    SalesFormLetterParmData.queryName() defines the default query for customer-related documents.

  • lukbel Profile Picture
    282 on at

    I managed to get the pick list to work! Thanks so much for all your help :)

    One last related question (I promise this is the last one). Is it possible to determine which sales document is running at runtime? For example by whether the subclass is SalesFormLetterParmDataConfirm or -PickingList etc? I was planning to make an if/switch statement for my two documents.

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Why do you need if/switch statement if you have polymorphism? It sounds like a bad design.

    If you put code to a parent class, not only that you don't need knowledge of child classes - having dependencies on child classes would go against advantages of the object-oriented design. Let child classes implement the specialized behavior - it's exactly why the child classes exist. Don't try to put specialized behavior into the parent classes; keep just the common logic there.

  • lukbel Profile Picture
    282 on at

    You're right, I've changed my tactic, I'm just doing it through overriding child class queryName() now with a custom query.

    One thing I thought I'd point out is if you're sitting on a sales order and you generate a pick list, it doesn't notice the added query range until you hit "Select" and manually decide the query. Does the query form initially load a different query to the one used in FormLetterParmData etc?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans