Problem Statement
Before 2012 version of Dynamics AX, ListPages were not so famous, as those are being used, widely, today.
But with growing use of ListPages, there were issues also, such as we don’t get enough room to use data methods, as we are forced to set display target to Client, if we have to use methods on ListPages.
One such interesting situation, happened with me, last days. I got a situation, where we were having a display method, displaying some information, let’s say displaying PO number on a List Page. We were unable to avoid display method, on ListPage. On the hand our client asked us, for “View details” Button, by right click.
That was deadlock situation, as we were unable to override jumpRef method. Because if that was a normal form, we were able to use, jumpRef. But here for specific page of ListPage, system did not gave us chance to override method on ListPage.
Solution
Declare a FormControl on class method of ListPageInteraction Class. Supposing my case/example I declared a control as below
FormStringControl varCtrlPurchId;
Now, proceed to initialized method. If that does not exists in Interaction Class, add a new one.
Here you will get currentRecord using name of DataSource, you will get controlId(which is basically control on ListPage). And at end you will call custom definition of your method. Going back to my demo example, here we go as below
public void initialized()
{
Array fields;
FormDataSource formDs;
Common currentRecord;
FormRun formRun;
super();
currentRecord= this.listPage().activeRecord('smmOpportunityTable_1');//name of exact DataSource. Don't mention Table.
formDs = currentRecord.dataSource();
formRun = formDs.formRun();
varCtrlPurchId = formRun.control(formRun.controlId("getPurchIdCtrl"));//name of exact control, by setting AutoDeclare = Yes
varCtrlPurchId.registerOverrideMethod(methodStr(FormStringControl, jumpRef), methodStr(SmmOpportunitiesInteraction, jumpRefPurch), this);
}
Now, Finally Write definition of your custom method. In our exampled case are going to override jumpRef, so I am going to write its custom definition
public void initialized()
{
Array fields;
FormDataSource formDs;
Common currentRecord;
FormRun formRun;
super();
currentRecord= this.listPage().activeRecord('smmOpportunityTable_1');//name of aexact DataSource. Don't mention Table.
formDs = currentRecord.dataSource();
formRun = formDs.formRun();
varCtrlPurchId = formRun.control(formRun.controlId("getPurchIdCtrl"));//name of exact control, by setting AutoDeclare = Yes
varCtrlPurchId.registerOverrideMethod(methodStr(FormStringControl, jumpRef), methodStr(SmmOpportunitiesInteraction, jumpRefPurch), this);
}
Save, Compile, Build CIL, close and reopen AX; Lets see where we reached.
Here we are with method ready and working, on ListPage, without setting the control Display Target property to Client.
Happy DAXing!!!

Like
Report
*This post is locked for comments