AX2012 Custom Lookup on a Dialog

Today I struggled with a custom lookup on a dialog in Microsoft Dynamics AX 2012. To prevent this from happening to me again, and maybe to help you out too, I will share the solution with you here.

The following code will utilize a class which extends the AX2012 RunBase class, with a simple dialog and a custom lookup on an added field.

DialogLookup class

classDeclaration

Here the class declaration, don’t forget to extend RunBase.

Methods:

Main

Nothing special here either, just get a new instance from your class, to be able to run it later on.

Our dialog

This is where the fun starts. You simply want to get the control from your field, then you call the registerOverrideMethod(…) and as parameter you provide your class name (in this case, the class we are actually writing here) and the method name (this does not have to be lookup!).

The custom lookup

In the last step we will just set up a “normal” (don’t forget the FormStringControl!) lookup method.

And this is what it looks like:

Just hit F5 and run your class.
AX2012 Dialog Custom Lookup Closed
The custom lookup provides us the class id. If I recall it right, the standard AX would provide the EDT Type.
AX2012 Dialog Custom Lookup Open

You may also like...

3 Responses

  1. George Franzkevich says:

    thank you!

  2. Than you good share.

  3. shakul says:

    Thank you so much

Leave a Reply

Your email address will not be published. Required fields are marked *