Using Modifiers

Use Modifiers to alter variable values at flow runtime.

We learned that Variables are placeholders for data coming from previously connected components in your flows that will be eventually replaced with real values once they are available at flow runtime. Sometimes you need to modify the values. For example, you receive a percentage value but you'd like to store it in the decimal format (i.e. 75 becomes 0.75). This is exactly where Modifiers excel.

**Example: Modify Percentages

In the example picture above, we use the "Percent" variable that comes from our online form ("NewFormSubmission" component). However, that value contains values such as "75". However, we'd like to store 0.75 to our spreadsheet, into the "Percentage" column. In order to do that, we want to modify the value of the variable at runtime (it's like applying a formula to the variable value). Just click the variable name in the inspector field to bring up the Modifiers dialog:

As you can see, the Modifiers dialog contains different categories for different type of variable values. In our case, we're interested in the "Number" category and the "Div" modifier that divides our Percent variable by another number that we specify. Just click the "Div" modifier to apply it to our variable and tell the modifier that we want to modify our value by 100:

Now press "Save" and you'll see the "Percent" variable changed appearance a little bit to tell you that it will be modified at runtime:

Example: Modify Dates

Let's see another example where we show how to modify dates. Imagine we keep a record of our employee's vacations and want to notify them by email and SMS two days before their vacation ends to remind them that they should come to work in two days. Our excel sheet can look like this:

Our "To Date" column contains the end date of the employee's vacation. However, we want to send them SMS and email two days before their first day at work. Therefore, we want to subtract one day from the "To Date" and wait for that new date to send them reminders. Our flow can look like this:

Notice how we use the "Wait" component to wait for a certain date. In the "Until" field, we use the modified "To Date" column value. We modified our variable with the "AddSpan" modifier from the "Date" category and filled "-1" for the "Days" parameter:


Modifiers are a powerful tool to modify variable values, change their format or even use conditionals and loops to structure the actual output of your variables. It's like applying excel formulas to your variables. Modifiers can be stacked, meaning that the result of one modifier is an input to another modifier used for the same variable (e.g. "divide by 10, then add 50, then round").

Here's a list of available modifiers:

Next Steps

This tutorial shows how flows can be shared in Automation Flow Engine either using The SnatchBot platform.

Did this page help you?