Top.Mail.Ru
Editing a Script
CTRL+K

Editing a Script

In this article
  • Editing a Script
  • Adding Blocks
  • Supported Data Types
  • Visual Mapping
  • Special Visual Mapping Mode
  • Adding and Deleting Connections Between Blocks
  • Actions with Blocks
  • Additional Actions with Blocks
  • Keyboard Shortcuts
  • Script Versions

In the script profile under the Script tab, you can activate the script or switch to edit mode. To enable the script, click Activate. To edit a script, click Edit.

The Script tab

In the History tab, you can see the execution history of the script. The history log in the script profile works similar to the Execution Log, except it does not include filtering, a search field, and the Workspace and Script columns.

The History tab

In the General tab, you can change the script's name, description, and its unique Key.

The Key value is generated automatically when a script is created or duplicated, but it can be changed: enter any combination of 1–40 characters and click Save in the header. The value must be unique.

The key is preserved during script export and import.

Note

The unique Key field ensures the script can be run from a dashboard even if the script's name has changed. However, if you change the key, the script will no longer run from the dashboard. In that case, you will need to reconfigure it.

The General tab also shows the workspace where the script was created and its current state if it has been run: activated or disabled.

The General tab

To start editing a script, open it and click Edit.

In edit mode, you can:

  • Rename the script
  • Add automation blocks
  • Configure the script execution order
  • Test individual blocks or the entire script
  • Publish the script
  • Manage script versions

To rename a script in edit mode:

  1. Click the context menu icon and select Rename script. Renaming a script
  2. In the dialog box that opens, enter the new script name. New script name
  3. Click Save.

Adding Blocks

When creating a new script, the Select a trigger block automatically appears.

On the left panel, you can configure the script’s schedule using:

A detailed description of script trigger blocks can be found in Trigger Blocks.

Adding a trigger block

Other blocks can be added to the canvas in two ways:

  1. Click the + icon below an existing block.
  2. Right-click a connection line and select Add.

Adding an action block

You can select action blocks from the left panel. First choose the group, then the specific action block. Each block has parameters, displayed on the left panel.

Categories, groups, and blocks are described in detail in Automation Blocks.

Action Blocks in Workspace

Supported Data Types

When creating new tables in a workspace (manually or from source data), you can select a system-defined data type from a dropdown list or enter a custom type manually.

The system supports the following data types:

  • String
  • Integer
  • Decimal
  • Boolean
  • Date and Time
  • UUID
  • String Array
  • Integer Array
  • Decimal Array
  • Boolean Array
  • Date and Time Array

The system can read, write, and in some cases convert different data types from various databases.

If a column's declared type does not match the actual data type, the system automatically attempts to convert it. If conversion is not possible, an error occurs.

Currently, conversion is supported in:

When using the Insert rows and Update rows blocks with ClickHouse connection, input data types may be converted to the target ClickHouse column types depending on compatibility.

In Get CSV, you can specify column types manually or load them from a sample CSV. All String values from CSV files will be automatically converted to the specified type.

When using JSON-related blocks — for example, New event (Webhook, Event processing), Manual start, New events (Tracker) — JSON arrays can be written to array column types such as Array(String) in ClickHouse.

Decimal (ClickHouse) and Numeric (PostgreSQL) conversions are not supported in the Insert rows and Update rows blocks. It is recommended to preprocess such data or use compatible types.

Visual Mapping

Each block has its own fields and can reference fields from preceding blocks. To make these fields available in visual mapping, the previous block must be run.

Visual mapping

In Insert rows and Update rows, you can automatically populate table fields with outputs from previous blocks.

To create columns and map fields automatically when manually adding a new table:

  1. Click Select from output fields. Select from Output Fields
  2. Choose the block whose output fields you want to use and click Add. Choose Output Fields
  3. The columns are added. Finish creating the table. Choose Output Fields

To automatically map fields into an existing table:

  1. Select the desired table. Select Table
  2. Click Autocomplete fields with output data. Autocomplete Fields
  3. Select the fields to map into table columns and click Apply. Preview Fields
  4. The fields are automatically mapped into the respective columns. Auto-Mapped Fields

In the left panel, you can also manually select fields for block parameters. By default, only blocks with available mapping fields are shown. Click the block name to expand the tree.

Mapping fields

If field names fully or partially match, suggested mappings will be automatically offered. Simply select the correct one without searching the tree.

Suggested Mapping Fields

If Ungroup array and Send request (HTTP) blocks return parent objects in their output, those objects also become available in the mapping list, allowing other automation blocks to use them.

Visual mapping fields are also shown in the right-hand panel in the editor, making them easy to insert into queries and code. For more details, see Query and Code Editor.

Special Visual Mapping Mode

By default, the values from mapping fields are inserted into block parameters in safe mode. This mode prevents the use of table or column names in mappings, protecting against SQL injections.

Sometimes, you may need to insert a table or column name stored in a variable into a query. In such cases, you can disable safe mode for the SQL Query and Select Rows by SQL Query blocks.

To pass a table or column name from a variable into an SQL query, place an exclamation mark ! before the substituted field.

Enabling special visual mapping mode

Note

A single SQL query can include different mapping fields — some using safe mode and others ignoring it.

If your query uses the system variable activity_table, you need place an exclamation mark ! before it as well.

Mapping the activity_table variable

Warning

Disabling safe mode may lead to SQL injections. Use this option only if you are certain the substituted data is safe.

Adding and Deleting Connections Between Blocks

The script execution order is defined by connecting blocks

To add a connection, click a block, select an entry or exit point and drag it to the desired block.

Creating a connection

Dragging one block onto another also creates a connection.

Note
  • A block can have multiple exits and one entry.
  • Each block must have at least one connection.

To remove a connection, right-click it and select Delete.

Deleting a link

Actions with Blocks

The block settings menu is located on the left panel. Here you can:

  • Rename the block
  • Edit block settings Changing block settings
  • View block output data and run the block Viewing output data
  • Search block output using Ctrl+F and Enter Searching output data

For details on output data display, see Known issues and limitations.

Additional Actions with Blocks

Right-clicking a block opens a context menu with additional actions:

  • Add an action
  • Duplicate
  • Replace
  • Cut
  • Copy
  • Paste
  • Delete

Additional actions with blocks

You can zoom in and out of the canvas with blocks using the mouse wheel or the Fit to size, +, and - buttons in the lower right corner. The lower right corner also contains the button for opening the list of published versions of the current script.

Adjusting size

When the script is ready, you can test and publish it.

Keyboard Shortcuts

In script edit mode, the following keyboard shortcuts are available:

  • Ctrl+plus button(+) and Ctrl+minus button(-) — zoom in and out of the canvas
  • Shift+Delete — delete the active block
  • Shift and left mouse button — select multiple blocks
  • Space — drag the canvas by holding down the key (on Linux available only when using TrackPoint)

Script Versions

To view version information for a script, click the version button in the lower right corner of the canvas.

Opening the versions panel

In the panel that opens, you can see the script version number, publication date, add a comment, and extend the storage period. Only the draft of the current version is editable. Other versions cannot be changed, but you can copy blocks from them.

To open a version, click it.

To add or edit a comment on a version, click the context menu icon of the version and select Comment.

Adding a comment

You can restore a version in two ways:

  • Click the corresponding button in its profile Restoring the version in the profile
  • Click the context menu icon and select Restore Version Restoring a version through the context menu

The current script version is stored indefinitely. Previous versions are stored for up to 30 days. You can extend a version's storage period by clicking the context menu icon and selecting Prolong storage.

Warning

Prolonging storage replaces the remaining days with the new period; it does not add to them.

Prolonging storage

To collapse the panel and view the selected script version in full screen, click the version button in the lower right corner.

You can return from a script version to the draft of the current version in two ways:

  • Click the X button in the upper right corner of the version panel
  • Click the Back button in the header

Going back to editing the current version

Was the article helpful?

Yes
No
Previous
Connections
We use cookies to improve our website for you.