Skip to main content

Posts

Showing posts with the label Axapta / Dynamics AX Refreshing a calling form from the called object

Refreshing (executeQuery) a calling form from the called form.

A feature that you often need when you work with code that is called from a form and manipulates data, is to be able to refresh the calling form to reflect the changes made, when the code has been run. This could also be a form calling an other form, where data changes are made, in the called form, but the changes must be reflected in the calling form, when the called form is closed. I have seen it done by making call back to a method on the calling form, that does the refresh. You can however make the refresh from the CALLED form or code, using an args-object. When a form calls an other form it is typically done via a menu item, and thus automatically an args object is passed to the called form. The args object can carry a tablebuffer object that is acessed with the record method on the args object. You can determine if the tablebuffer object is a formDataSource, and if so, you can instantiate a formDataSource-object on which you call the executeQuery-metod. One example could be: Form