D365FO – AX – Change a dialog field value when another field value changes in a simple dialog form using registeroverride method

On a Simple dialog form when the dialog checkbox “Ignore minimum qty” is false then disable the dialog checkbox “dialogShowUsrDialog” else enable it and set the value to true.

To do this we need to call the registerOverrideMethod when declaring dialogfields and write a new modified method.

public void openQtyParmsDialog()

{

   dialog = new Dialog(“Check Quantities”);

   dialogIgnoreMinQty = dialog.addField(extendedTypeStr(NoYesId), “Ignore minimum Qty”);

   dialogShowUsrDialog = dialog.addField(extendedTypeStr(NoYesId), “Pop-up message”);

   //Override modified method for dialogIgnoreMinQty

   dialogIgnoreMinQty.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(ERAStageCheckPurchTable, dialogIgnoreMinQty_modified), this);

   dialog.run();

if (dialog.closedOk())

   {

       this.parmCheckMinQty(!dialogIgnoreMinQty.value());

       this.parmShowUsrDialog(dialogShowUsrDialog.value());

   }

}

private boolean dialogIgnoreMinQty_modified(FormCheckBoxControl _dialogIgnoreMinQty)

{

   //If IgnoreQty = true then dialogShowUsrDialog value is false and disable

if (_dialogIgnoreMinQty.value() == true)

   {

       dialogShowUsrDialog.value(false);

       dialogShowUsrDialog.enabled(false);    

   }

else

   {

//If IgnoreQty = false then dialogShowUsrDialog value is true and enabled

       dialogShowUsrDialog.value(true);

       dialogShowUsrDialog.enabled(true);    

   }

return true;

}

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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