Canvas comes with a library of ready-made blocks for supported applications, but you may find that you have specific needs that are not covered by these blocks.
While you can customize any blocks directly in the workflow, it is usually better to create a new block template with the new functionality: A block template will let you manage and update the block across all workflows where it is used, and also add block questions (block settings selectable in the UI without the need for coding).
To create a new block template head to the Workbench section:
...
Click the + sign to create a new block template.
In this case we will create a new block for the Test application (which is registered to our account), which will return an array of employee names from the Test app API. (The Test app provides dummy data for testing purposes.)
...
You will now be presented with the block template editor.
The editor has four tabs:
The Configuration Manager tab lets you create block questions, which are settings that can easily be changed by without the need for coding to customize the block.
The Code Editor tab is where you write and debug the code for the block
The Input Model tab lets you define the schema/model that the block accepts/expects as input.
(This information is used by the Mapper block to fill out field names and types in the mapping table.)The Output Model tab lets you define the schema/model that the block gives as output.
(This page is often left blank, as the Mapper block can dynamically create the model by sampling the output data from the block.)
Configuration Manager
The Configuration Manager tab lets you configure the block settings (aka “block questions”) that will be shown to users of the block:
By adding block questions to the template you can create easily configurable settings for users of the block. The settings are shown in the template editor UI (under the “Working Area” tab), and can easily be changed by anyone without the need for coding, and without the need to customize the block.
About the fields:
The Title is a short description of the setting
The Information field can be used to provide additional info to the user. It is shown when hovering the pointer over the ℹ️ icon in the block settings
...
The Tag name provides the name of the variable containing the settings, which can be accessed in the block code via getVariables()
The Control type field lets you select the input type for the setting.
...
The DataSource path field is where you select or define the option set for the control type, in cases where there are pre-defined options.
For example, if you want to provide a dropdown menu (via the “Select” Control type), you can defined the dropdown options here.
To create a new option set, simply start typing a name, and click “Add item…”:
...
When you click on “Add item …” you will be presented with a popup where you can create a list of the options for the block question:
...
The “Label” field
Add block questions
...
Note that the value selected will be the default for this field, in this case the field useAllEmployes will be a boolean with default value “true”
...