Skip to main content

Generic blocks

Canvas offers three generic blocks, which are multi-purpose and can be used in any workflow: The Join, Mapper, and Code blocks.

generic-blocks.png

The generic blocks are available for use in any workflow

The Join block​

The Join block can be used to combine the output of several blocks into one Datasource array, to feed into another block.
In general, most workflows in Canvas are executed top-to-bottom, with the first block feeding data into the second, and the second into the third, etc. in a linear way. But there are cases where you would want the data from the first two blocks to be combined before feeding into the third. In such cases you can use the Join block.

![datasource 1.png](datasource 1.png) The Join block lets you select multiple outputs (Datasources) to be added to a new, combined output (Datasource array)

(See other articles for more information about block responses and Datasource)

The Mapper block​

The mapper block is used to transform (map) fields and values between differing data formats for various applications.
The Mapper block provides a UI similar to a spreadsheet, which lets you choose how fields in the source data should be mapped to the target data: mapping.png

The mapper block maps values from the Source data model to the Target data model, as specified in the table shown here.

The Mapper block is a powerful tool that includes advanced functionality, such as support for functions to transform mapped values. This is explained in more detail in separate articles: https://connectmyapps.atlassian.net/wiki/spaces/CA/pages/96043045

The Code block​

The Code block is a generic, all-purpose block for writing code that will run as part of your workflow. It is useful if you quickly need to add some extra code to a workflow. debug.png The Code block can be edited under the Debug tab by writing modern JavaScript.

Even though the Code block can technically be used for pretty much any purpose, we recommend creating non-generic block templates if the code you are writing is specific to an application that will be reused in different workflows.
Block templates have the benefit of being version controlled, more modular, easier to map (by defining data models), and they enable you to create user options that can be easily changed in the block options.