What are Variables?
How to use predefined values that can be accessed in the subsequent steps of a Flow
Zenphi offers a way to create predefined Variables that can be accessed in the subsequent steps of a Flow. These variables are defined using a given data type and this guide will elaborate on zenphi Variables.
In this article we'll learn:
- What are Variables?
- How to Create Variables ?
- Example of Using Variables in the Flow
What are Variables?
Zenphi variables hold predefined data values which can be used in the subsequent actions of a Flow. There are two approaches to creating variables in Zenphi.
1.Directly from toolbar
2.Using Set Variable Action
Directly from toolbar
In the Zenphi Flow Designer, a Variables button is located on the toolbar at the top of screen as shown in the following:
Upon clicking on the Variables button, this side menu will be shown as follows:
As you can see, the Variables section can be used to create variables by clicking on the Create Variable button.
Furthermore, different types of variables can be created such as String, Number, Boolean, DateTime, Integer, Decimal , File and also Object.
If object get selected as the type, then you can define properties for the object according to your need :
After selecting it's type , it should be determined that the variable must act as a single value by selecting the Store a single value option or as a collection/list of values by selecting the Store multiple values option :
Using Set Variable Action
The ‘Set Variable’ action which is available under the Control Flow category can be used to create variables for a given flow. Upon dragging and dropping the ‘Set Variable’ action, it is possible to create a new Variable by clicking on the add variable icon in the Settings tab as shown in the following:
Example of Using Variables in the Flow
In this example, we will send an email to a recipient using a Zenphi Flow. The email address of the recipient, subject, and body of the email will be provided by variables.
Step 01
Click on the Variables button on toolbar at the top of the flow designer. Then we will be creating three variables to store the email address of the recipient, subject, and body of the email as follows.
All three variables are accepting String-type values. Upon creation of these variables, those should be available to access through the token picker.
Step 02
Let’s start building the Zenphi flow by dragging and dropping the Set Variable action to the flow as shown in the following.
Now let’s set the values for the three predefined variables created via the Configuration window. In the Settings tab, you can select the variable and set the preferred value as follows, and you can click on "Assign another variable" to set more than one variable in one action.
Step 03
Drag and drop the Send Email(Gmail) action. Go to the Settings of the Send Email action. The To, Subject, and Body input fields support the token picker.
Let’s access the three variable values via the Token Picker:
As you can see, the three fields(To, Subject, Body) have been filled with the predefined variable values as shown above.
To summarize, the Variables can be predefined via the configuration window for Zenphi flows. These variable values can be set using the Set Variable action and accessed through the token picker.
Updated 6 months ago