AX / D365FO – Insert a Yes/No Message box on a Form Click Button event

While any operation is performed by the user, there are cases such as need to receive confirmation from the user to perform the operation. In these cases we can use “DialogButton” for user interaction not say “Yes/No” to perform the operation.

Below is an example code

public void clicked()
{
   DialogButton diagBut;   

   str strMessage = 'By clicking OK you confirm to save data into form, do you still want to continue?';

   str strTitle = 'My Title';

   diagBut = Box::yesNo(strMessage, DialogButton::No, strTitle);

   if (diagBut == DialogButton::No)
   {

        info('Operation canceled');

   }
   else if(diagBut == DialogButton::Yes)
   {  
        Info('button click code here');
   }
}

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 )

Facebook photo

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

Connecting to %s