How to refresh the data source of caller form using X++ in AX 2009?
In many cases you need to refresh the data source of the caller form when you finishing work with the current form like when you using posting form you need to refresh the data source of the caller form to see the effect write the following code in close method of the current form :
public void close()
{
FormRun callerForm;
;
callerForm = element.args().caller();
callerForm.dataSource().refresh();
callerForm.dataSource().reread();
callerForm.dataSource().research();
super();
}
public void close()
{
FormRun callerForm;
;
callerForm = element.args().caller();
callerForm.dataSource().refresh();
callerForm.dataSource().reread();
callerForm.dataSource().research();
super();
}
Comments
Your code is not working instead it is getting hanged. pls try the below code
public boolean canClose()
{
boolean ret;
#Task
FormRun formRun;
ret = super();
// Get an instance of the calling form.
formRun = element.args().caller();
// If the caller is a form, refresh that form.
if(formRun)
{
formRun.task(#taskF5);
}
return ret;
}