Friday, June 22, 2018

AX 2012 List page multi select datasource records AX2012

There may be situation to select multiple records in the list page and send it to other class to do some operation on the selected records. Below code will help you handle the same.

Step 1: Create new List page / Use the existing list page

Step 2 : Add menu item button in the list page  (For this example, you added an action menu item to call a class)

Step 3 : Choose the Multi select property to 'Yes'

Step 4 :  In the main method of the called class, Initialize the FormRun object.

 FormRun formRun;

 formRun = args.caller();


Step 5 : Initialize FormDatasource object to get the active records from the List page.

FormDatasource fds;

fds = formRun.pageInteraction().page().activeRecord('ListPageDataSourceName').dataSource();

Step 6 : Fetch the records that are marked in the list page

Common record;
CustTable custTable;

for (record = getFirstSelection(fds); record; record = fds.getNext())
{    
     custTable = record;
}


Best Regards,
Arun S Keerthi

2 comments:

  1. Hi there,I enjoy reading through your article post. Thank you for sharing.
    MS Dynamics AX Online Training

    ReplyDelete
  2. This blog is really awesome Thanks for sharing the most valuable information with us.
    D365 Finance and Operations Online Training

    ReplyDelete