- Building Flows
- Passing Data
Building Flows
Passing Data
Using data from previous steps in the current one
Data travels through the flow starting from the trigger until the last piece in the flow.
This allows flows to be so powerful as you can design each step to work with the flowing data.
We’ll go through both types in detail.
Steps Output
Each step of your flow has an input that flows in and an output that flows out.
You can use the output of any previous step in the currently selected step settings.
If the input is a text input then all you need to do is just click on the input and the dropdown with (Data to insert) will show.
If the input is of any other type you will notice a dynamic value button at the top right corner of the input which will turn it to a text input.
Example
We’ll add 2 code pieces, the first one will return a JSON object, and the second one will use it.
Using Steps Output
- Start a new flow.
- Set the trigger to anything (we’ll only run the flow through Test flow).
- Add a code piece, add the following code to it:
exports.codePiece = async (params) => {
return {
type: "alien",
color: "green",
age: 1200
};
};
- Add another code piece, we want to pass the output of the previous code step to this one, and use it to construct a sentence.
- In the Parameters section of the piece settings, we’ll set the following parameters:
- We’ll use the 3 parameters in the “Params Example” step and the following code for the step:
exports.codePiece = async (params) => {
return "I am a "+ params.color +" "+ params.type +" and I am "+ params.age +" years old!";
};
- Click on Test flow and watch the output of the second code piece. It will look like this:
Congratulations 🎉 You are now capable of passing data through flow steps!
${step_name.path_to_property}
.
This is used with JSON inputs like the body of an HTTP request