Run Actions from RunJS query
Actions are normally configured through an event handler in the App Builder, but you can also trigger them programmatically from a RunJS query using the actions.* API. This is useful when the logic is conditional, needs to run inside a loop, or needs to combine several actions together — see Custom Code: Control Components for more on when to reach for RunJS.
This page is a quick-reference of every action's RunJS syntax, grouped the same way as the Actions Reference. Each entry links to the action's own page for full parameter details, behavior notes, and examples.
Run Action
| Action | RunJS syntax |
|---|---|
| Run Query | queries.<queryName>.run() or await actions.runQuery('<queryName>') |
| Reset Query | queries.<queryName>.reset() or await actions.resetQuery('<queryName>') |
| Abort Query | queries.<queryName>.abort() or await actions.abortQuery('<queryName>') |
| Show Alert | actions.showAlert('<alertType>', '<message>') |
Control Component
| Action | RunJS syntax |
|---|---|
| Control Component | await components.<componentName>.<csaMethod>(<params>) — invoked directly on the component, not through actions.* |
| Show Modal | actions.showModal('<modalName>') |
| Close Modal | actions.closeModal('<modalName>') |
| Set Table Page | Not available via actions.* — use await components.<tableName>.setPage(<pageIndex>) |
| Scroll Component into View | actions.scrollComponentInToView('<componentName>') |
Navigation
| Action | RunJS syntax |
|---|---|
| Switch Page | await actions.switchPage('<pageHandle>') (optionally with query params — see the action's page) |
| Go to App | actions.goToApp('<slug>', queryParams) |
| Open Web Page | Not available via actions.* — use window.open('<url>', '_blank') |
Variable
| Action | RunJS syntax |
|---|---|
| Set Page Variable | await actions.setPageVariable('<key>', <value>) |
| Unset Page Variable | await actions.unsetPageVariable('<key>') |
| Unset All Page Variable | actions.unsetAllPageVariables() |
| Set Variable | actions.setVariable('<key>', <value>) |
| Unset Variable | actions.unSetVariable('<key>') |
| Unset All Variable | actions.unsetAllVariables() |
Other
| Action | RunJS syntax |
|---|---|
| Logout | actions.logout() |
| Generate File | actions.generateFile('<fileName>', '<fileType>', '<data>') |
| Set Local Storage | actions.setLocalStorage('<key>', '<value>') |
| Copy to Clipboard | actions.copyToClipboard('<contentToCopy>') |
| Toggle App Mode | actions.toggleAppMode('<light|dark>') |
Reading query and variable data
These aren't actions — they're getters for immediately reading state right after triggering a query or setting a variable in the same RunJS query.
Query data
await queries.getSalesData.run();
let value = queries.getSalesData.getData(); // resolved data
let raw = queries.getSalesData.getRawData(); // raw response
let loading = queries.getSalesData.getloadingState();
The response returned by actions.runQuery() / queries.queryName.run() is an object containing both status and data, so you can also read it inline:
const response = await actions.runQuery('getOrders', { limit: 10 });
return response;
// { status: "ok", data: [ { id: 1, customer_name: "John Doe", total: 250 } ] }
Variables
actions.setVariable('mode', 'dark');
return actions.getVariable('mode');
actions.setPageVariable('number', 1);
return actions.getPageVariable('number');
Running multiple actions from a RunJS query
Use async/await to sequence several actions together. The example below runs two queries and shows an alert at a fixed interval — see the full guide on running queries at specified intervals.
actions.setVariable('interval', setInterval(countdown, 5000));
async function countdown() {
await queries.restapi1.run();
await queries.restapi2.run();
await actions.showAlert('info', 'This is an information');
}