Skip to main content

Function

Defines a TypeScript function inside the widget. Functions run in a sandbox iframe, can only read data, and must return a plain object.

Signature

Attributes

Property elements

Field/output types: String / Number / Bool / DateTime / Json / Binary, or a Struct name.

Script variables

Input, Inputs, Resources, Data, Results, Host (Notify / OpenUrl / Navigate / Log).

Results

  • Results are written to {Results.<Function>.<Output>}.
  • An object must be returned; a missing output key or a basic type mismatch is an error.
  • Date is serialized as an ISO string.

Sandbox

  • CSP blocks network, images, media, sub-frames, and workers.
  • No DOM, localStorage, fetch, import / require.
  • On timeout the iframe is destroyed and recreated.
  • Remote widgets may contain scripts and update silently, so only use widgets you trust.

Editor

The “Functions” tab lets you edit the script, autocomplete Input / Inputs / Resources / Data / Results / Host, and run a test execution.

Gotchas

  • You cannot await fetch; load data beforehand with Data.
  • You cannot run commands or call the plugin API directly; use button/trigger actions.
  • Prefer CDATA in Function.Script so that < is not parsed as a tag.