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);

        }
 

}

No comments:

Import and Export file from BLOB storage Account(Azure) in D365 F&O using X++

  Import and Export file from BLOB storage Account in D365 F&O using X++ Import: /// <summary> /// MKInventQualityOrderLineService...