how to close AddOn form after adding a record
I am implementing a AddOn that has its own form operating on User-Defined-Object.
Please tell me how can I force form to close after record is added/inserted.
I was trying to override FORM_DATA_ADD Event (after event) but neither form.Close() nor form.Items.Item("2").Click() (simulation of cancel buton) didn't work for me or caused unexpected close of SAP B1
Pedro Magueija replied
Form_Data_Add (after) event occurs before the Item_Pressed (after) event. B1 needs the form that initially triggered the Item_Pressed open (perhaps this is why you get the errors).
You could catch the Item_Pressed (after) event on the add button (id = 1) and the use the simple form.Close();
By that time no other (native) events should be triggered and the form.Close() should be successful.