Creating multi-select lookup dialog for SSRS report parameter in MS Dynamics AX 2012

Hello All,
I just recently found a way to create a multi select lookup
dialog for SSRS report parameter using SysLookupMultiSelectGrid
class. I thought it might be helpfull for other developers
as well since I couldn’t find any other Blog or Post answering this issue.

I am just assuming that you know how to create a simple dialog
for reporting parameter. However, if you don’t know this link might be helpfull to you.

I will just write those methods which will create a multi select
dialog. So, here we go.
Step 1:
In your data contract class declaration method, define your
parameter with ‘List’. For example I want to create a multi select dialog for
customers in which I need Customer account to be selected when a user selects
any customer. SO, I will write

List accountNum;

In your DataMemberAttribue method type
the following code

AifCollectionTypeAttribute('AccountNum', Types::String),
public List parmAccountNum(List _accountNum = accountNum)
  accountNum = _accountNum;
  return accountNum;

Your screen will look like this


Step 2:
Now that you have completed the contract class, let’s move on to
the UI Builder class. In your main lookup method write the following code.

public void lookup(FormStringControl _control)
  Query query = new Query(queryStr(CustTableSRS));

  container cnt;
  SysLookupMultiSelectGrid::lookup(query, _control, _control, cnt);

you may have to create 3 more methods to run your code without any
error. They are getFromDialog, initializeFields
and postRun. Here is the code for these methods. you have to change the contract class name with your
contract class
First create a new mothod for initializeFields and paste the following code

public void
  custMultiSelectContract contract = this.dataContractObject();

Then create another method for getFromDialog

public void getFromDialog()
  custMultiSelectContract contract = this.dataContractObject();

and then another method for postRun

public void postRun()
  custMultiSelectContract contract = this.dataContractObject();

That’s it. You are now done. Run your report and enjoy.

Passing Arg from MenuItem to JOB/Class

To pass args from MenuItem to desired Class/Job :

On MenuItem Button properties give the Datasource Name of which your desired arguments have 

Write Below code on MenuItem Clicked()

void clicked()
// super();

MenuFunction mf;
args args = new Args();


mf = new menufunction(identifierstr(Mzk_WarehouseUpdateForItem), MenuItemType::Action);;


Below code in class/Job

inventItemLocationlocal = _args.record();