Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Why would overriding a lookup method on a datasource field not work, but the override on the control for that field does?

Posted on by 2,005

This isn't a big deal, because I can do what I am doing by overriding the form control lookup method, but I am now curious as to why what I originally tried to do wouldn't work.

We added the InventBatch table to the InventRegistrationWMS form in the grid with the InventTrans datasource and joined it to the associated InventDim datasource. However, we had to rename the data source because many of the methods on that form have local InventBatch variables and by naming the new datasource InventBatch, I would have had to refactor many of those methods. so we instead called it ParentBatchRef, because we are trying to assign source parent batches to newly registered batches (we have added new fields to the InventBatch table to allow this.) In order to provide a list of the batches used on the ProdBOM record for the production order, I overrode the lookup method on the InventBatch.ParentInventBatchId field we added to the InventBatch table and wrote a query that should only return the batches used by the ProdBOM record. The lookup worked, but it didn't limit it to just the ProdBOM batch references. When I set a breakpoint on the overridden method, it is completely ignored when doing the lookup. 

I went to the Microsoft site looking for answers, and decided to try overriding the lookup method on the control itself. I placed the same code in the overridden lookup method of the form control with one minor modification (in the field lookup method, the form control is passed as a parameter to the method and when invoking the SysTableLookup object you need to pass that parameter, in the control lookup, the control is calling the method so you pass the control as this when invoking SysTableLookup.) When I placed the code in the control lookup override, it worked exactly as I expected it would work in the field lookup override.

Does anyone know why one override works and the other doesn't? Or more to the point, why is the field lookup method being ignored? 

Thanks.

Brandt

*This post is locked for comments

  • Brandt Fundak Profile Picture
    Brandt Fundak 2,005 on at
    RE: Why would overriding a lookup method on a datasource field not work, but the override on the control for that field does?

    Brandon,

    That worked. Thanks for the tip.

    Brandt

  • Brandon Wiese Profile Picture
    Brandon Wiese 17,786 on at
    RE: Why would overriding a lookup method on a datasource field not work, but the override on the control for that field does?

    Of course the client must be closed.  In fact shut down the AOS and the client, and delete the AUC files only then, just to be certain.

  • Brandon Wiese Profile Picture
    Brandon Wiese 17,786 on at
    RE: Why would overriding a lookup method on a datasource field not work, but the override on the control for that field does?

    I was only suggesting AUC files.

  • Brandt Fundak Profile Picture
    Brandt Fundak 2,005 on at
    RE: Why would overriding a lookup method on a datasource field not work, but the override on the control for that field does?

    Brandon,

    Should I delete the AUC or clear the SysSQMSettings.GlobalGUID value as well?

    Brandt

  • Verified answer
    Brandon Wiese Profile Picture
    Brandon Wiese 17,786 on at
    RE: Why would overriding a lookup method on a datasource field not work, but the override on the control for that field does?

    I've only seen this behavior when AUC files are corrupted.  Have you deleted those?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,963 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans