Friday, October 5, 2018

Refresh Listpage from Child form AX 2012

Write your code in Child form by Override method Close and write the below code.


public void close()
{
#Task
FormRun formRun;
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);
}
}

Use Form Method -- Task()

Task() - The user performs some task in a form by using the toolbar, the menu, or the keyboard.
For Example Here I am Closing the Form by pressing TAB
Steps:
1. Create a Form Ex: Test Form
2. In Design node Take string Edit Control.
3. Create Task() method in Form Methods.
4. Set the Debug Mode on Task() method. Using this debug you can find Keyboard ID (like here we are doing through TAB)
5.Then Press F5.
6.Enter some text in String Edit control.
7.It will take to you  on Debug Mode.Here (ret = super(_taskId);) you will get the Task ID.
8.Then you can write the Code..
=========================
public int task(int _taskId)
{
int ret;

ret = super(_taskId);// task Id will get keys ID value
if(_taskId == 2827)//2827 is the TAB ID
element.close();

return ret;
}