Often we create lots of dialogs in our development for user input and many times we face situations where we need to populate lookups in one field depending on the data in other fields.
In form it is very easy to override the lookup method of the control and write the suitable logic to implement the lookup. But what about dialogs, how do we create selective lookups in dialogs…
Here is a sample class developed on AX 4.0 SP2 platform illustrating the selective lookups creation in dialogs.
The main points to remember are…
- The field in the dialog is a FormStringControl type and not DialogField type
- The class extends from RunBase class
- We need to enable the control method over loading option (Can be viewed in the dialogPostRun method in the sample class in the above link)
- We need to write a lookup method with the name <ControlName>_lookup and write the lookup logic in this method