Skip to main content
Skip table of contents

Code action deep-dive

The Code Action provides a great method to maximize your flows flexibility using Javascript language.

The language you can use is actually Javascript. We plan to add more languages in the future, starting with Python support.

You will mainly use the Code Action to develop “low code” automation when you need advanced features only provided by a programmatic approach. Keep in mind that no async features are allowed. You can only use synchronous coding. If you need to get some data from a remote web services you can do it prepending a Web Request action to the Code Action.

Use context.attributes.KEY or context.attributes[KEY] to read the value of a flow attribute

Ex.

let age = context.attributes.age;

Use context.setAttribute(KEY, VALUE) to set the value of an attribute

Ex.

context.setAttribute('age', 35);

In the following example you can test how the Code Action works.

In this example we execute a couple of tasks:

  1. Modify the existing “age” attribute set up using the Set Attribute action (age = 2)

  2. Add a totally new attribute (jsondata) to the flow

You are the able to see the result printed in the reply:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.