Skip to main content

closeBackgroundForm

Description​

Closes a background Form and releases it from memory completely. Passes the result value to the callback registered with openBackgroundForm().

Parameters​

ParameterTypeDescription
formPathStringPath of the Form to close
resultdynamicResult value passed to the opener's callback

Returns​

void

Notes​

  • The Form instance is removed from memory. Calling openBackgroundForm() again with the same path loads it fresh.
  • Specifying a path that isn't loaded causes no error — the call is ignored.
  • You normally call this from a script inside the background Form, but an external force-close also works.

Example​

// Force-close the Form from outside
$app.closeBackgroundForm("alarm/watcher", { cancelled: true });

// Return a result from inside the background Form, then close it
// (from a script inside the Form)
$app.closeBackgroundForm("alarm/watcher", { ok: true, data: someData });
  • $app.openBackgroundForm(formPath, linkArg, callback) — Open a background Form
  • $app.hideBackgroundForm(formPath) — Hide only the UI without closing
  • $app.isBackgroundFormLoaded(formPath) — Check whether it's loaded