Friday 27 March 2020

Enable / allowEdit of datasource field on a listPage (ListPageInteraction class) + AX 2012

Here we will see how to make a field alloEdit based on some condition in the ListPage form.

As we all now, every list page has the Interaction class, here we have a method selectionChanged() which is used to get the current record reference, it is similar to active method.

now Override the selectionChanged() method and write the below code to access data source property in ListPageInteraction class.

 public void selectionChanged()
{

        FormDataSource  reqPO_ds;
        ListPage    listPage = this.listPage(); 


        // This will get the recored
        ReqPO       reqPO    = listPage.activeRecord(querydatasourcestr(ReqTransPOListPage,ReqPO)) as ReqPO; 
       // This will get the dataSource Object
       reqPO_ds =   listPage.activeRecord(queryDataSourceStr(ReqTransPOListPage,ReqPO)).dataSource();

        super();
       if (//Add condition
       {
         allowEditFieldsOnFormDS_W(reqPO_ds, false);
         reqPO_ds.object(fieldNum(ReqPO, TruckId)).allowEdit(true);

        }
 

}

Update NuGet package to new MS D365FO version

1. Import the NuGet package files from LCS for that particular version please take the PU version files only. a. Goto LCS-->Asset Libra...