Tuesday, 13 February 2018

Simple dialog creation in Ax 2012

Simple dialog creating in Ax2012

Description: Creating simple dialog box in Ax2012. How to create dialog and get user input in the dialog

Code:

static void TestDailog(Args _args)
{
    // Author : Rajaram.E
    // Title  : Simple dialog creation  
    Dialog      dialog;
    DialogField dialogField;
    DialogGroup dialogGroup;
    ;
    // creating new dailog instance and  title
    dialog = new Dialog("Test dialog");
    // adding group title
    dialogGroup = dialog.addGroup("Test dialog group");
    // adding field it's must be EDT, if relations true means enable lookup
    dialogField = dialog.addField(extendedTypeStr(Name));
    // calling run method for build a dialog
    dialog.run();
    // option Ok or cancel
    if(dialog.closedOk())
    {
        // if click ok button they will get and display user value
        info(strFmt("%1",dialogField.value()));
    }   
}

Output:

Value get from user:


Lookup in dialog box :

Description: Add must EDT relation and set label, help text

Code:


static void TestDailog(Args _args)
{
    // Author : Rajaram.E
    // Title  : Simple dialog creation  
    Dialog      dialog;
    DialogField dialogField;
    DialogGroup dialogGroup;
    ;
    // creating new dailog instance and  title
    dialog = new Dialog("Customer info");
    // adding group title
    dialogGroup = dialog.addGroup("Customer");
    // adding field it's must be EDT and set label and help text
    dialogField = dialog.addField(extendedTypeStr(CustAccount),"Customer id","Customer account");
    // calling run method for build a dialog
    dialog.run();
    // option Ok or cancel
    if(dialog.closedOk())
    {
        // if click ok button they will get and display user value
        info(strFmt("%1",dialogField.value()));
    }   
}

Output:

Adding tabpage in the dialog :

Description: Adding multiple tab page in the dialog box 


Code:

static void TestDailog(Args _args)
{
    // Author : Rajaram.E
    // Title  : Simple dialog creation  
    Dialog      dialog;
    DialogField dialogField;
    DialogGroup dialogGroup;
    ;
    // creating new dailog instance and  title
    dialog = new Dialog("Customer info");
    // adding group title
    dialogGroup = dialog.addGroup("Customer");
    // adding field it's must be EDT and set label and help text
    dialogField = dialog.addField(extendedTypeStr(CustAccount),"Customer id","Customer account");
    
    dialog.addTabPage("Detail");
    dialogField = dialog.addField(extendedTypeStr(CurrencyCode));
    dialogField = dialog.addField(extendedTypeStr(CustPaymMode),"Paym mode");
    
    // calling run method for build a dialog
    dialog.run();
    // option Ok or cancel
    if(dialog.closedOk())
    {
        // if click ok button they will get and display user value
        info(strFmt("%1",dialogField.value()));
    }   
}


Output:




No comments:

Post a Comment

Step-by-Step Guide to Restore a SQL BACPAC File - Microsoft dynamics D365 Fin & Ops

 Restore steps for bacpac file in to SQL server - Microsoft dynamics D365 Fin & Ops. Log in to LCS and navigate to the asset library. On...