Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh entire form in AX 2012?

I'm currently working with a form that has a grid at the bottom. Whenever I hit f5, the grid refreshes, but the rest of the form does not. What can I do to make the entire form refresh it's data?

Thanks.

like image 509
Mr. Dynamic Avatar asked Oct 03 '12 13:10

Mr. Dynamic


People also ask

How to refresh caller form?

To refresh the parent form, open the form you use to call the dialog or drop dialog form where you added the previous code. Select a record, open the dialog form, and make a change to a field that appears on the parent form. Click OK to close the dialog form.

How to refresh datasource in D365fo?

Right-click the Methods node under the data source, point to Override Method, and then click refresh.


2 Answers

You may override the research method on a datasource:

public void research(boolean _retainPosition = false)
{
    super(_retainPosition);
    other_ds.research(_retainPosition);
}

The other_ds is a datasource not joined by the current datasource.

like image 131
Jan B. Kjeldsen Avatar answered Oct 07 '22 18:10

Jan B. Kjeldsen


It depends on the form you are working with. When you hit F5 on a record, it runs the research method on the datasource the record belongs to or its parent datasource (depends on the form's query, e.g. if you hit F5 on SalesLine in the SalesTable form, SalesTable_ds.research(true) will be run). As I see it, if the rest of your form displays fields that belong to these datasources then these fields will be updated. If the fields do not belong to these datasource the rest of your form will not be updated (unless e.g. the active method has been overridden to refresh the rest of the form from the code.

What you can do to make the entire form refresh its data when F5 is hit: again, it depends on the form, so not knowing all the details it is difficult to advise something, but one of the things you can do is override the research method on your datasource and refresh the rest of the form programatically from there. It is more common to override the active method, you should normally go for it.

like image 24
10p Avatar answered Oct 07 '22 19:10

10p