On dialogs – SysLookupMultiSelectCtrl in Dynamics AX 2012

This post is in continuation of my old post which helped to use SysLookUpMultiSelectCtrl class on Forms.
The below class will help you to implement the same in the dialogs [Used Runbase framework]. Please note I have used the same query [CustTableLookUp] which I used in my last post.

Please follow the class and its methods as shown below.

public class SR_LookupMultiSelectDialog extends RunBase
{
DialogRunbase dialog;
DialogGroup dialogGrp;

FormBuildStringControl fbsCtrlMultiSelect1;
FormStringControl fsCtrlMultiSelect1;

container returnIds1;

SysLookupMultiSelectCtrl msCtrl1;
}
__________________________________________________
public ClassDescription caption()
{
return ‘Multiple select lookup on dialog’;
}
__________________________________________________
// Generate dialog
public Object dialog()
{
FormBuildControl setupGroupControl;

dialog = super();

dialog.alwaysOnTop(true);
dialog.windowType(FormWindowType::Standard);
dialogGrp = dialog.addGroup(‘Group’);

setupGroupControl = dialog.formBuildDesign().control(dialogGrp.formBuildGroup().id());

// Control with the MULTI-SELECT
fbsCtrlMultiSelect1 = setupGroupControl.addControl(FormControlType::String, identifierstr(ctrlRoles1));
fbsCtrlMultiSelect1.label(‘Select multiple customers’);

dialog.allowUpdateOnSelectCtrl(true);

this.dialogSelectCtrl();

return dialog;

}
__________________________________________________

public void dialogPostRun(DialogRunbase _dialog)
{
FormRun formRun;

super(dialog);

formRun = _dialog.dialogForm().formRun();

if (formRun)
{
fsCtrlMultiSelect1 = formRun.design().control(fbsCtrlMultiSelect1.id());
msCtrl1 = SysLookupMultiSelectCtrl::construct(formRun, fsCtrlMultiSelect1, querystr(CustTableLookUp));

}
}
__________________________________________________

// Get input values
public boolean getFromDialog()
{
#Characters

// Return Ids from the 1st mutli-select control
if (msCtrl1)
returnIds1 = msCtrl1.get();

info(‘Control 1 – ‘ + con2StrUnlimited(returnIds1,#SEMICOLON));

return true;
}
__________________________________________________

static void main(Args _args)
{
SR_LookupMultiSelectDialog SR_LookupMultiSelectDialog = new SR_LookupMultiSelectDialog();

if (SR_LookupMultiSelectDialog.prompt())
{
SR_LookupMultiSelectDialog.run();
}
}
__________________________________________________


Below is the dialog [Screen shot for reference ] which will allow to select multiple values from the lookup

Please refer to Tutorial_LookUpMultiSelectDialog for more detailed example.

Happy Dax 6ng
Sreenath

Advertisements

One Response to “On dialogs – SysLookupMultiSelectCtrl in Dynamics AX 2012”

  1. gollapudipavan Says:

    sir your blog is very nice and it is help ful to us


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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: