Skip to main content

Functions overview

Learn about functions in Actioner.

A function in Actioner is a building block written in JavaScript. It is a set of statements that performs a task or calculates a value.

Actioner supports using longer snippets of JavaScript via functions. If you're looking to write a lot of JS, you shouldn't inline it between {{ }}. Functions let you write larger, reusable, blocks of code and enable you to generate some pretty complicated JavaScript snippets.

Functions are setup to extend the capabilities of your actions. Once created, they are scoped to the action. By adding a function, you can manipulate and transform any data generated by the action it is added to. If you find yourself using the same or similar blocks of code multiple times throughout your action, it might be worth pulling that out into a function.

More than the ability to write longer JavaScript code, functions also enable you to store data in key:value pairs and call them whenever they are needed.

You can store data —and their values— both on action level and on app level and extend the functionality of your actions to work with other workflows and actions across your app.

Why use functions?

1. Longer JavaScript snippets

If you're looking to write chunks of JS, creating a function is a good option. You shouldn't inline your code between {{ }} and keep forcing for one-liner JS codes. Inside a function, you can write larger, reusable blocks of code.

2. Storing and accesing data

Functions enable storing values dynamically and calling them whenever they are needed.

If you are looking to build dynamic data as specific actions or requests are executed and re-use that data across other components in your actions or across other actions and workflows in your apps, you can add a new function.

With a function, you can write data to an action's context and to your app's store through .put() method and use .get() method to retrieve them.

Creating a function

Navigate to your action's Functions tab and click + Add function to create a new function. Give a name to your function.

Adding your function to Run steps

After you add a function, do not forget to add it to Run steps. A function is executed only if it is added to Run steps.

Deleting a function

Click ellipsis … and select Delete to remove a function from your action.


Do not forget to remove your function from Run steps.