RE: Close sales order/purchase order window after full invoice.
Hi Jonathan.
I had a similar requirement and I have tested different scenarios.
The only solution is that (in my case):
- in my Code part, before the Runmodal, there is a GET
SalesHeader.Get(SalesHeader."Document Type"::Invoice, "Document No.");
- after this GET I add a SETRANGE to something, which is Unique and not exists in other Sales Header Records. In my case for example the "Job No." in the Sales Header:
SalesHeader.SetRange("Job No.", JobPlanningLineInvoice."Job No."); // set to Job No. to Close Page after POST
- After this SETRANGE you can call the original PAGE.RunModal(PAGE::"Sales Invoice", SalesHeader);
For example an Event which is Delete the Sales Header (the POST is this for example), the NAV cannot move to the Next record, because does not matched by the SETRANGE "Job No.".
It force the Sales Hader Page to Close.
Please try it. Thanks.