Save record without prompting the user

Whenever a form is losing focus or moving to a different record or the form document containing it is being closed and the data in the current record has been altered, the user is prompted with a question on whether they want to save the data in the current record. In some cases, I want to prevent that prompt and have it just save the record. I have this:

Sub ForceSave(oEvent)
dim oLaunchingFormModel
dim oLaunchingFormController

oLaunchingFormModel = oEvent.Source.Model
oLaunchingFormController = ThisComponent.CurrentController.getFormController(oLaunchingFormModel)

oLaunchingFormController.formOperations.execute(8)
End Sub

but what event do I need to attach it to?

  • Before unloading
  • When unloading
  • Before record change
  • After record change