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:

How to Delete an SSRS Report from SQL Server Reporting Services (SSRS) in D365FO

 In Microsoft Dynamics 365 Finance & Operations, SSRS reports are deployed to the SSRS server and stored in the ReportServer database. W...