ctx.getModel()
Retrieves a model instance (such as BlockModel, PageModel, ActionModel, etc.) from the current engine or view stack based on the model uid. This is used in RunJS to access other models across blocks, pages, or popups.
If you only need the model or block where the current execution context is located, prioritize using ctx.model or ctx.blockModel instead of ctx.getModel.
Use Cases
Type Definition
Parameters
Return Value
- Returns the corresponding
FlowModelsubclass instance (e.g.,BlockModel,FormBlockModel,ActionModel) if found. - Returns
undefinedif not found.
Search Scope
- Default (
searchInPreviousEngines: false): Searches only within the current engine byuid. In popups or multi-level views, each view has an independent engine; by default, it only searches for models within the current view. searchInPreviousEngines: true: Searches upwards along thepreviousEnginechain starting from the current engine, returning the first match. This is useful for accessing a model on the page that opened the current popup.
Examples
Get another block and refresh
Access a model on the page from a popup
Cross-model read/write and trigger rerender
Safety check
Related
- ctx.model: The model where the current execution context is located.
- ctx.blockModel: The parent block model where the current JS is located; usually accessible without needing
getModel.

