Running Script from Dashboard
When working within a single space, it is possible to run a script directly from a dashboard without switching to the script editor. It can be configurated in the Table widget.
Some usage examples include:
- Adding, deleting or updating table rows
- Performing an action in another system:
- Creating issues
- Increasing the priority of an issue
- Sending messages
Configuring a Script
To launch a script from the dashboard, create a script that can be used for configuring an action in the Table widget. To do this:
- Create a new script in the Data Panel of workspace.
- The first block (trigger) must be Manual start. Only scripts with this trigger can be used to run actions.
- Configure the expected fields. They will be filled in by the user or automatically when the action is launched from widget. In the block parameters:
- Specify the field name
- Select the data type (text, integer, date or date and time)
- If a series of data is going to be received, check the Array box
- You can make the field mandatory by using the Mandatory field switcher
- Click Continue. A modal window appears with the created fields. Fill them in and click Execute. The block will be tested and the date and time of execution, as well as the values entered in the fields, will appear in the left panel.
- Add a block, for example to delete or update a table row.
- Select the table to be modified and map the fields using visual mapping.
- Test the block and publish the script.
If the script is not published, it will not appear when configuring buttons in the Actions tab in the Table widget.
Adding an Action to a Table
Actions are triggered in view mode via configured buttons above the Table. First, add a button, then assign actions to it.
Create or select the Table for which you want to configure an action. Open the Actions tab in the right-hand panel and click + Button.
After clicking, button configuration parameters appear. These are identical to those used in the Button widget.
Configuring the Action
To configure an action:
- In the button settings, click the Click action field.
- Click + Action.
- Select the script to be executed when the button is clicked in browse mode.
Action Configuration Parameters
- Name — displayed on the button
- Description — shown as a hint during script execution
- Run the script — the dropdown list shows only scripts that return data
- Parameters — configured individually for each field from the script. You can rename the field and must select an input method
- Hint — text displayed on hover over the button in view mode (maximum length: 160 characters)
- Activating the button — allows you to define a condition under which the button becomes clickable in view mode. The condition can be specified via formula or variable. Only Static list-type variables are available when using variable-based activation. If the condition’s value does not match the current variable value, the action button remains disabled in view mode. Additionally, you can select the button type (primary, secondary, or link) and configure the base border and text color
- Hide inactive button — available for the Button widget
- Auto update — triggered after script execution. You can refresh data in the widget from which the script was launched, in all widgets and placeholders on the view, or disable this option
When configuring an activation condition via a formula that relies on data from a related table in the data model, the widget data may be filtered. Only rows with corresponding data in the related table will be displayed—this ensures the activation condition can be reliably evaluated against existing data.
Behavior in Browse Mode
A button with a single action becomes active when:
- Required parameters are configured
- Table rows are selected in browse mode (if required)
- The activation condition is met
Clicking such a button either executes the action immediately or opens a modal window for parameter configuration.
If a button has multiple actions, it is enabled immediately. Clicking it opens a dropdown list of actions. List items corresponding to unconfigured actions are disabled.
If the Table is small, buttons above it may be collapsed into a single context-menu button.
Hint display logic:
- If a hint is defined for the button or action, it appears on hover
- If hints are defined for both the button and an action, the button’s hint takes precedence and is shown on hover
Configuring the Input Method
- For each action, the script parameter name and type are also displayed.
- Parameter order can be changed by dragging and dropping. The change also appears in the action launch form.
Column
The script parameter receives a value from the table selected in the list.
Variable
Specifies a system variable or a dashboard variable (static or dynamic list). For this method, the variable must be exposed in a Parameter widget. The script receives the default or selected value from the Parameter. The value cannot be changed during action execution.
From Data Model
Allows using a list of tables or columns from the Data Model as parameter values. Selection occurs in the modal action launch window in Browse mode.
Tables list is the primary parameter, and Column list is dependent. To use Column list, you must first configure a parameter using Tables list.
When configuring Column list, you must specify the Linked parameter, which selects the table whose columns display. Only parameters using Tables list appear in the dropdown.
In Browse mode, the Column list parameter field becomes active only after a table is selected in the primary parameter.
If the expected field in the script is an array, then when using the From Data Model input method for a table list parameter, only one table can be selected. However, multiple columns can be selected for the column list parameter.
If the input method of primary parameter is changed, set to Column list, or deleted, the dependent parameter becomes unconfigured.
Formula
A formula allows configuring a dynamically changing parameter. When the Consider filters toggle is enabled, filters applied in Browse mode are applied to the list values. The parameter can also be hidden.
Set by Aggregation
A formula can pass an aggregation result to the expected field of script. The aggregation result must match the expected data type of field. In Browse mode, during action execution, the field using this input method is populated with the formula result. Upon script execution, the function result is passed to the expected field. If the expected field is an array, the function must return an array.
When using Row filter, the value is calculated considering the selected rows.
Manual
During action execution, data is entered manually into the Default value field. Additionally, you can:
- Add a description
- Enable row filtering
- Configure custom validation. To view the validation configuration tooltip, click the question mark icon next to the Validation field.
- Hide the parameter (it will not appear in the action launch window)
Static List
A static list is created; during execution, the user selects a value from the list in the script launch window. The list can be defined using YAML. One or multiple default values can be entered or selected in the Default value field.
Dynamic List
A dynamic list is created; during execution, you can select a value from the list in the script launch window. Additionally, you can configure:
- Display list
- Default value
- Row filter
- Predefined filters (+ Filter button)
- Switchers:
- Hide parameter — the parameter does not appear in the action launch window
- Entering any values — in Browse mode, a single value not present in the dynamic list can be entered and submitted. This switcher is hidden, if the expected script field is an array
- Validation — available only when the Allow arbitrary values toggle is enabled. To view the validation configuration tooltip, click the question mark icon next to the Validation field.
- Consider filters — data passed to the parameter respects filters applied in Browse mode
Action Execution
After configuring the action, a button appears above the table. It becomes active in Browse mode.
When all required parameters are configured, publish the dashboard.
To run the action, click the button. If the input method is Column or Set by formula, the button remains inactive until rows are selected. To select individual rows, check their checkboxes. Checking the column header selects all rows.
Row selection is preserved separately for each page. Applying filters or sorting to table columns resets row selection.
If you accidentally click the script launch button, start another script while the launch loading animation is displayed. In this case, the launch window of the first script does not open.
The script launch window opens. Fill in the required fields and any others as needed. Click Run or press Enter to run the script. To cancel, click the close icon in the top-right corner.
For non-required fields with a pre-filled value, you can clear it by clicking the close icon that appears on the right side of the field when hovering.
- If expected fields in the Manual start block are modified, the expected field name changes in the widget action settings, but the input method configuration remains unchanged.
- The action applies only to the first 1 000 selected rows.
- Script execution is available to users with read and/or edit access to the workspace and dashboard.
Action execution is not possible when:
- The script is deleted
- The Manual start trigger block in the script is replaced
- The referenced table is removed from the Data Model
- An empty value from a related table column is used. The column property must be changed to Nullable view and edit table
When the script runs, the message Action "Action name" started appears in the bottom-right corner. Upon successful completion, appears message Action completed. If execution fails, an error message is displayed. Depending on the error, you may navigate to the execution log, retry the script, or close the window.
Examples of Running Scripts from Dashboard
To perform any action, a script must be created.
Adding Row
To add a row to a table:
- Create a new script in the dashboard.
- Add a Manual start block. Add expected fields, specify data types, and click Continue. Use column names from tables in the Data Model. Test the block.
- Add an Insert rows block. Select the target table and map the columns to the expected fields defined in the first block. Use visual mapping for convenience. Test the block.
- Publish the script.
- Open the dashboard containing the required table. Add an action in the Actions tab and provide it with a name. For each field’s parameters, specify the desired input method and column. To ensure the result is displayed after script execution, set the Auto update parameter to This widget.
- Publish the dashboard. Click Add row above the table. Enter the required parameters and click Run.
- The row has been added.
Removing Rows
To remove rows from a table:
- Create a new script in the dashboard.
- Add a Manual start block. Add an expected field, specify the data type, and click Continue. Use a column name from the Data Model table. Test the block.
- Add an SQL query block with a delete statement. Test the block.
Example SQL query to remove a row:
DELETE FROM tasks_table_1 WHERE incident_id = ${a1.Incident ID}; - Publish the script.
- Open the dashboard containing the required table. Add an action in the Actions tab and assign it a name. In the field’s parameters, select the Column input method and choose the same column that is referenced in the script’s SQL query. To display the result after script execution, set the Auto update parameter to This widget.
- Publish the dashboard. Select the rows to delete and click Remove rows above the table. Click Run.
- The rows have been removed.
Changing the Priority
To change priority:
- Create a new script in the dashboard.
- Add a Manual start block. Add expected fields, specify data types, and click Continue. Test the block.
- Add an Update rows block. Specify the target table, key column, key value, and map the priority column. Use visual mapping for convenience. Test the block.
- Publish the script.
- Open the dashboard containing the required table. Add an action in the Actions tab and assign it a name. For each field’s parameters, specify the appropriate input method and column. To display the execution result after the script runs, set the Auto update parameter to This widget.
- Publish the dashboard. Select the rows for which to change priority. Click Change priority above the table. Enter or select the new value and click Run.
- Priority has been updated for the selected tasks.
Custom Validation
Custom validation allows you to define your own conditions that input field values must satisfy when launching a script. Conditions are specified using ClickHouse syntax—for example, you can require a specific character count in a field, or define dependencies between parameter values, etc. To view the validation configuration tooltip, click the question mark icon next to the Validation field. The same tooltip is also available in the Formula Editor.
In the Formula Editor, a dedicated tab listing script parameters is available during validation setup. To include a parameter in the condition, simply click it—the correct syntax and escaping are applied automatically.
Example of Custom Validation Usage
Let’s consider how validation works using an example where only integer values are considered valid.
- A table with columns Product, Original price, and Comment is added to the view. Configure an action to add new rows.
- Create a new script in the workspace (named New row in this example). Add a Manual start block. Add expected fields Product, Unit price, and Comment. Test the block.
- Add an Insert rows block to the script. Select the target table and map columns to expected fields.
- Publish the script and return to the view. Select the table and add a new action. Select the previously created script.
- Configure parameters. Set the input method to Manual for all parameters.
- For the Unit price parameter, enter the following formula in the Validation field:
This formula uses ClickHouse syntax. If any non-digit characters are entered in Unit price, the error message Value must be an integer appears below the field.
if(NOT match($${Unit price}, '[0-9]'), 'Value must be an integer', null) - Click Publish and test the script. Click the New row button above the table. In the modal window, fill in the fields. If an invalid value is entered in Unit price, an error appears. The Run button remains disabled until the data is corrected.
Script and Action Configuration in YAML
Configuration requires the actionButtons block. The tables below list the keys used within this block.
| Key | Type | Definition |
|---|---|---|
| name | string | Button name |
| onClick | — | Click action |
| hint | string | Hint for the button |
Click Actions (onClick block)
The onClick block uses the following keys:
| Key | Type | Definition |
|---|---|---|
| type | enum | Click action type. Only EXECUTE_SCRIPT is supported |
| name | string | Action name |
| scriptKey | string | Script key |
| parameters | — | Script parameters (optional) |
| autoUpdate | enum | Auto update: - NONE — none- THIS_WIDGET — this widget- ALL_WIDGETS — all widgets |
| description | string | Description (optional) |
| buttonType | enum | Button type: - primary — primary- primary-outlined — secondary- link — link |
| color | string | Button text color |
| backgroundColor | string | Button background color |
| borderColor | string | Border color for secondary button |
| activateCondition | — | Button activation |
Parameter Configuration (parameters block)
The parameters block defines script parameters:
| Key | Type | Definition |
|---|---|---|
| name | string | Parameter name in the script |
| displayName | string | Display name |
| inputMethod | enum | Input method for the variable |
| isHidden | boolean | Hide parameter |
| dbDataType | enum | Data type of the column from the Data Model |
| hideInactiveButton | boolean | Hide inactive button |
Button Color Configuration (backgroundColor, borderColor, and color blocks)
When configuring the backgroundColor, color, or borderColor blocks, use the keys described below.
| Key | Type | Definition |
|---|---|---|
| mode | enum | Coloring mode: - AUTO — automatic- BASE — solid |
| value | string | HEX color code (enclosed in double quotes) |
Button Activation Condition (activateCondition block)
The activateCondition block defines button activation conditions:
| Key | Type | Definition |
|---|---|---|
| mode | enum | Activation mode: - VARIABLE — by variable- FORMULA — by formula |
| variableName | string | Variable name (double-quoted; applicable only for VARIABLE mode) |
| variableValue | string | Variable value (double-quoted; applicable only for VARIABLE mode) |
| formula | string | Formula (double-quoted; applicable only for FORMULA mode) |
Input Method (inputMethod key)
The following input methods are available:
COLUMN— columnVARIABLE— variableDATA_MODEL— from Data ModelFORMULA— formulaAGGREGATION— define by aggregationMANUALLY— manualSTATIC_LIST— static listDYNAMIC_LIST— dynamic list
Column (COLUMN) settings:
| Key | Type | Definition |
|---|---|---|
| tableName | string | Table name |
| columnName | string | Column name from the table specified in tableName |
Variable (VARIABLE) settings:
| Key | Type | Definition |
|---|---|---|
| sourceVariable | string | Variable name |
From Data Model (DATA_MODEL) settings:
| Key | Type | Definition |
|---|---|---|
| option | enum | Usage option: - TABLE_LIST — table list- COLUMN_LIST — column list |
| parent | string | Name of the main parameter using TABLE_LIST. Applicable only for COLUMN_LIST |
Formula (FORMULA) settings:
| Key | Type | Definition |
|---|---|---|
| formula | string | Formula |
| filterByRows | boolean | Compute formula considering the filter on selected rows |
Define by aggregation (AGGREGATION) settings:
| Key | Type | Definition |
|---|---|---|
| formula | string | Formula (supports aggregate functions) |
| filterByRows | boolean | Compute formula considering the filter on selected rows |
Manual (MANUALLY) settings:
| Key | Type | Definition |
|---|---|---|
| defaultValue | string | Default value |
| filterByRows | boolean | Compute formula considering the filter on selected rows |
| validation | string | Validation |
| description | string | Field description |
Static list (STATIC_LIST) settings:
| Key | Type | Definition |
|---|---|---|
| options | string | List of values |
| defaultOptionIndex | number[] | Default value index |
Dynamic list (DYNAMIC_LIST) settings:
| Key | Type | Definition |
|---|---|---|
| options | string | List (defined by formula) |
| displayOptions | string | Displayed list (defined by formula) |
| insertAnyValues | boolean | Allow arbitrary values toggle. In view mode, a single value not present in the dynamic list can be entered and submitted. |
| validation | string | Validation (applies only when insertAnyValues is enabled) |
| defaultValue | string | Default value (defined by formula) |
| filterByRows | boolean | Compute formula considering the filter on selected rows |
| filters | — | Predefined filters (optional) |
| considerFilters | boolean | Apply filters from view mode |
Example of actionButtons Block Usage
widgets:
- key: table (1)
apiVersion: "17"
type: TABLE
settings:
actionButtons:
- name: Rows
onClick:
- type: EXECUTE_SCRIPT
name: Add Rows
scriptKey: bf29c4de-8349-4e59-9e1b-f33c40bb1814
parameters:
- name: Product
inputMethod: COLUMN
columnName: Product
tableName: product_new
displayName: ""
isHidden: false
dbDataType: String
- name: Unit Price
inputMethod: COLUMN
columnName: Unit Price
tableName: product_new
displayName: ""
isHidden: false
dbDataType: Float64
- name: Comment
inputMethod: COLUMN
columnName: Comment
tableName: product_new
displayName: ""
isHidden: false
dbDataType: String
autoUpdate: THIS_WIDGET
description: ""
activateCondition:
formula: ""
mode: FORMULA
buttonType: primary
color:
mode: AUTO
backgroundColor:
mode: AUTO
Was the article helpful?