ctx.view
The currently active view controller (dialog, drawer, popover, embedded area, etc.), used to access view-level information and operations. Provided by FlowViewContext, it is only available within view content opened via ctx.viewer or ctx.openView.
Use Cases
Note:
ctx.viewis only available in RunJS environments with a view context (e.g., inside thecontentofctx.viewer.dialog(), in dialog forms, or inside association selectors). In standard pages or backend contexts, it isundefined. It is recommended to use optional chaining (ctx.view?.close?.()).
Type Definition
Common Properties and Methods
Currently, only
dialoganddrawersupportHeaderandFooter.
Common inputArgs Fields
The fields in inputArgs vary depending on the opening scenario. Common fields include:
Access these via ctx.getVar('ctx.view.inputArgs.xxx') or ctx.view.inputArgs.xxx.
Examples
Closing the Current View
Using Header / Footer in Content
Branching Based on View Type or inputArgs
Relationship with ctx.viewer and ctx.openView
ctx.viewer is responsible for "opening" a view, while ctx.view represents the "current" view instance. ctx.openView is used to open pre-configured workflow views.
Notes
ctx.viewis only available inside a view; it isundefinedon standard pages.- Use optional chaining:
ctx.view?.close?.()to avoid errors when no view context exists. - The
resultfromclose(result)is passed to the Promise returned byctx.viewer.open().
Related
- ctx.openView(): Open a pre-configured workflow view
- ctx.modal: Lightweight popups (info, confirmation, etc.)
ctx.viewerprovides methods likedialog(),drawer(),popover(), andembed()to open views. Thecontentopened by these methods can accessctx.view.

