Smarter dialogs

20 Jun

I don’t know about you, but it seems to me that dialogs for jobs in AX gets more and more complicated. I have a feeling a few of them could solve most of the world’s problems with hunger and pollution, if I could only figure out how fill the dialog fields correctly…
Users need help and guidance with the dialogs and to give the best guidance you may need to react to the choices made by the user in the dialog.
Two methods on RunBase allow you to hook up some events from the dialog form with your RunBase inheriting class:

  • dialogSelectCtrl is executed every time a new control is selected. I.e. when you move from one field to another.
  • dialogTask is executed every time the task method of the dialog form is called.

Here’s an example of how you can enable or disable fields based on what the users selects.

class dialogTest extends RunBase
    DialogField     dialogFieldCustVend;
    DialogField     dialogFieldCustAccount;
    DialogField     dialogFieldVendAccount;
public container pack()
    return conNull();
public boolean unpack(container packedClass)
    return true;
static void main(args _args)
    dialogTest   dialogTest = new dialogTest();
protected DialogRunBase dialog()
    DialogRunBase   dialog = super(dialog, true);
dialogFieldCustVend = dialog.addField(typeId(NoYesId), "Show vendor?");
dialogFieldCustAccount = dialog.addField(typeId(CustAccount));
dialogFieldVendAccount = dialog.addField(typeId(VendAccount));
// We start out by disabling the VendAccount field
return dialog;
public void dialogSelectCtrl()

   dialogFieldCustAccount.enabled(dialogFieldCustVend.value() == NoYes::No);
   dialogFieldVendAccount.enabled(dialogFieldCustVend.value() == NoYes::Yes);
Leave a comment

Posted by on June 20, 2012 in X++



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

365 by Thijs

Blogging about Microsoft 365, Azure and Automation!


Blog about ax with sample codes, tips and tricks.

GM Dynamics Blogs

Transform IT with Digital Trasformation and Social Innovation

Ms. Dynamic Millennial

Unboxing Microsoft Dynamics 365 for Finance and Operations


Exploring the new vision of the Power platform

Dynamics Vision 365

The FinOps pulse

Breaking Bong

I write when no one is watching


Microsoft Dynamics 365 Business Management Solution Enthusiast

Dynamics 365 Finance

Dynamics 365 Finance & Much More.

Microsoft Dynamics AX


Sumit Potbhare

Dynamics 365 for Commerce

This is your site about D365 (Finance and Supply Chain Management), IoT (Internet of Things) and HoloLens

Omni 365

Dynamics 365 Finance and Operations Blog

DIY D365

Power Platform Done Your Way

%d bloggers like this: