Simple Dialog using X++ – Dynamics 365 for Finance and Operations

Posted by

Scenario: Sometimes we need a simple dialog having some fields and we do not want to use dialog form ,instead of that we can create dialog thru X++ code.

Below is the code you can use to create simple dialog.

Example Code:

      

//Declare dialog variables       

Dialog                  dialog;       

DialogField             fieldfDate, fieldtDate;       

FromDate _fromDate, _toDate;       

;       

dialog = new Dialog(“Select start and end date”);       

//define fields to show on the dialog       

fieldfDate = dialog.addField(extendedTypeStr(TransDate));       

fieldtDate = dialog.addField(extendedTypeStr(TransDate));              

dialog.run();       

if (dialog.closedOk())       

{

           //get values from the dialog fields

            _fromDate = fieldfDate.value();

            _toDate = fieldtDate.value();   

}

Advertisements

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 )

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.