Skip to main content

Dialog in AX 2012 (MultiSelect control in Dialog):

Hi, let me walk-through the dialog feature in AX 2012.

Sometime when developing complex functionality, Dialog plays a significant role. Creation of dialog always provide you lot of standard features such as standard dialog form throughout ax, batch tab under form, validations, pack – unpack to persist the last storage value, to select query values(SysQuery form) etc..
Illustrating the dialog in AX2012 – Creation of dialog fields using standard dialogfield methods (which gives us lookup using EDT) or get custom lookup using formbuild control under the dialog and also get an benefit of having multi select under lookups. At the same time we can also achieve Sysquery form (Select button) under the dialog through classes.



We can have multi select control for dialog field using code below:

class VT_DialogEx extends RunBaseBatch
{
    DialogField                 df, df1;
    CustAccount                 ct;
    DialogGroup                 dfg, dfg1;

    CustAccount                 dfval;

    QueryRun                    queryRun;

    FormStringControl           fsc;
    FormBuildControl            fbc;
    FormBuildStringControl      fbsc;


    SysLookupMultiSelectCtrl    sysms;

    container                   conValues;

}

protected Object dialog()
{

    DialogRunbase   dialog = super();

    dialog.allowUpdateOnSelectCtrl(true);
    dfg1 = dialog.addGroup("Standard Lookup");
    df = Dialog.addField(extendedTypeStr(CustAccount));
    df1 = dialog.addFieldValue(extendedTypeStr(Name),"");
    df1.allowEdit(false);
    dfg = dialog.addGroup("Custom Lookup");
    fbc = dialog.formBuildDesign().control(dfg.name());

    fbsc = fbc.addControl(FormControlType::String, "User id");
    fbsc.label("User id");

    return dialog;
}


public void dialogPostRun(DialogRunbase dialog)
{
    FormRun                 fr;

    super(dialog);


    fr = dialog.dialogForm().formRun();
    if (fr)
    {
        sysms = SysLookupMultiSelectCtrl::construct(fr, Fr.design().control(fbsc.id()), queryStr(VT_UserInfoQuery));
    }
   // dialog.formRun().controlMethodOverload(true);
   // dialog.formRun().controlMethodOverloadObject(this);


}

public void initParmDefault()
{

    Query query;

    ;

    super();

    query = new Query();

    query.addDataSource(tableNum(vendtable));

    queryRun = new QueryRun(query);

}


public QueryRun queryRun()
{
    ;
    return queryRun;
}



As shown in above image we get multi select option for Userid field in dialog and once clicking on ok button retrieve the dialog field using code below:

public boolean getfromdialog()
{
    boolean ret;
   // info(strFmt("%1", df.value()));

    dfval = df.value();

    conValues = sysms.get();

    //info(strFmt("%1", con2StrUnlimited(convalues)));
    return super();
}


Do let me know if you are looking for XPO of it.

Stay tuned.. Happy Daxing J

Comments

  1. Replies
    1. i am trying to add a report parameter in rdp which take multiple value but it is not taking the value can you send any work on ssrs report at rohitsinghbatchu@hotmail.com thanks you.

      Delete
    2. Create UIBuilder class for the report and under the PostRun method using "registerOverrideMethod" you can use --> SysLookupMultiSelectGrid::lookup(query, _control, _control, cnt);

      Soon going to post on the specified topic. Thanks & Keep visting for more threads.

      Delete
    3. thanks vishal for your reply but i get empty mutliselect box i have creatyed a static query and tried it out with dynamic query but nothing seems to work!!!!!

      Delete
    4. i get a blank multiselect box and query has all the data.............

      Delete
  2. XPO please. navinkeshav@gmail.com

    ReplyDelete
  3. Hi may i ask for the XPO? thank you. siasonivan@gmail.com

    ReplyDelete
  4. Hi,

    I would also like the XPO please. fredrik.brandt@gmail.com
    Thanks.
    /Fredrik.

    ReplyDelete
  5. Please sendme xpo, for this example.

    ReplyDelete
  6. XPO please. jkarlyt@yahoo.com.mx
    Thanks.
    /JCT

    ReplyDelete
  7. Hi Vishal,

    Its working, thanks for the post.

    And i need to filter the multi select control values based on the another control of the same dialog.

    ReplyDelete
  8. Hi Vishal Tiwari,

    Please send me xpo for example.

    arip.saepudinn@gmail.com

    Thanks

    ReplyDelete
  9. Hi Vishal,

    Please send me xpo on paragchapre@gmail.com

    ReplyDelete
  10. Hi Vishal,
    Please send me xpo on s.sanamehmood@gmail.com
    Thanks

    ReplyDelete
  11. Hi Vishal,
    Please send me xpo on ramosjef@gmail.com
    Thanks

    ReplyDelete
  12. hi Vishal,

    Please send me xpo on jintinytiny@yahoo.com

    Thanks,

    ReplyDelete
  13. plz Kameran_lak@libero.it

    ReplyDelete
  14. The variable conValues seems to not be available in the 'run' method. I can't use my multiselected options anywhere outside of 'getFromDialog'.

    ReplyDelete

Post a Comment