Thursday, January 12, 2023

Auto refresh the parent form when child form is closed using x++

 I got a requirement to refresh the parent form If the child form is closed or any dialog form is open from the parent form.

  • For this, I have used the "FormHasMethod" standard function.
  • I have created a new method in my parent form. Check the Below code.

[ExtensionOf(formStr(SalesLineOpenOrder))]
final class SalesLineOpenOrder_Extension
{
    public void RefreshSalesLine()
    {
        SalesLine_DS.research();
    }
}


On closing of child form write the following method :

    public void close()
    {
	super();

	if(formHasMethod(element.args().caller(), identifierstr(RefreshSalesLine)))
	{
		FormRun formRunObject = element.args().caller();

		formRunObject.RefreshSalesLine();
	}
    }


Keep Daxing!!

No comments:

Post a Comment