Hi all,
I got 3 forms one opening another one and i need to find a way to when closing my third form to refresh data displaying on the first one.
I hope my image will be correctly understood.
Regards.
Hi all,
I got 3 forms one opening another one and i need to find a way to when closing my third form to refresh data displaying on the first one.
I hope my image will be correctly understood.
Regards.
Okay then try the below suggestion.
On the FormB init method get the caller of FormA. Below code will be on FormB.
[Form] public class FormB extends FormRun { FormRun fRun; //override init method of form and get caller form run. public void init() { fRun = element.args().caller(); } //now you need to call the FormC upon closing of FormB //override closeOk method of form. public void closeOk() { Args args; FormRun formRun; super(); //Call the form directly. args = new Args(formStr(rsmMake)); //now pass FormA caller. args.caller(fRun); formRun = new FormRun(args); formRun.init(); formRun.run(); formRun.wait(); } }
Now on the FormC add the below code.
[Form] public class FormC extends FormRun { FormRun fRun; public void init() { fRun = element.args().caller(); // here u will get FormA caller } //now override the closeOk method of form. public void closeOk() { FormDataSource fds = fRun.dataSource("Mention the FormA table name"); now call refresh and research method. fds.refresh(); fds.reread(); fds.research(); } }
If it's still not working debug the code and check.
Thanks,
Girish S.
When i close form C i came back to form A
Automatically
Tell me one thing when you close FormC if it automatically navigates to FormA or you need to write the code in Close method to navigate to FormA?
Thanks,
Girish S.
public void close()
{
super();
Args args = new Args(formstr(FormA));
FormRun formRun = classFactory.formRunClass(args);
// If the caller is a form, refresh this form
if(formRun)
{
#Task
formRun.task(#taskRefresh);
}
}
I tried this code.
Hi Mack,
Create an event handler on clicked event of 3rd form Close button.
Call the below method on main datasource of FormA.
DS.executeQuery();
DS.research();
These methods help you in refreshing a form which does the same function where we will click refresh button on form.
Can you share your code?
Thanks,
Girish S.
Hi Girish and all,
I didn't understood how to do it
I tried your ways but my formrun datasource got 'null' value.
Could you explain step by step please ?
Regards.
Hi Mack Note,
While calling the FormC from FormB pass the caller form as FormA and add the code to refresh caller DataSource (Here FormA will be caller DataSource) in FormC.
Refer to the below code for refresh caller form datasource.
https://axnotesblog.wordpress.com/2019/03/14/refresh-caller-form-in-d365fo/
Thanks,
Girish S.
André Arnaud de Cal... 291,391 Super User 2024 Season 2
Martin Dráb 230,445 Most Valuable Professional
nmaenpaa 101,156