Close form after bound object deleted

I have Suppliers who are organised into SupplierGroups such that each Supplier has a SupplierGroup, and many Suppliers can have the same SupplierGroup. I have a SupplierGroup form with a list of Suppliers which are in that SupplierGroup. From here, the user can select a Supplier and edit it, potentially removing it from the SupplierGroup. If a Supplier is removed from a SupplierGroup and the SupplierGroup then has no Suppliers in it, it may be deleted. The problem is that a SupplierGroup can be deleted whilst its form is still open. In that case, if the user clicks on Save, he gets one of these: 2010-02-22 16:28:29.636 ERROR - EXTERNALINTERFACE: A runtime exception occurred 1 2010-02-22 16:28:29.636 ERROR - EXTERNALINTERFACE: 1 But I don't want to close the SupplierGroup detail form when I start editing a Supplier, because in most cases the user will want to return to the SupplierGroup detail and look at more Suppliers. How can I handle gracefully a situation in which a form's Save button is selected when the bound object has been deleted whilst the form was open? I tried using a custom Save button which just closes the SupplierGroup detail form if the object reference is empty, but this still produces the error. Can I get a reference to the form in question at delete time and close it in Java? I ca't think of anything else likely to work.
1 answers

You can't close any specific forms, only the current one. I'm not sure there's a really elegant solution for your problem yet. I suppose you could close the form of the SupplierGroups when you start editing a Supplier to avoid the problem, then when you're done editing the Supplier and his group still contains other Suppliers, you could re-open the SupplierGroup form in the save microflow.