The 'Store to Variable' block in Journeys allows you to save a value or an expression to an existing variable. This can be useful for sharing discount codes with customers or for storing intermediate results during a workflow.
Use Cases:
The store to variable feature can be used in a variety of situations, such as:
Caching the value of a variable so that it can be accessed later without having to recalculate it.
You can use the store to variable feature to store the value of any variable, including arrays, objects, and functions.
You can also use the store to variable feature to store the value of an expression, such as a mathematical equation or a logical expression.
Steps to Store a Value:
1. Locate the 'Store to Variable' Block:
Find the 'Store to Variable' block in the 'Action' tab and add it to your flow.
2. Select the Variable Type:
You can choose to store a simple value or an expression.
Storing a Simple Value:
Enter the Value: Input the value you want to store in the variable. This could be a fixed number, a text string, or other predefined content or a variable like discount code.
Choose a Variable to Store the Value: Select the variable where you want to save this value.
Tip: It's best to use a variable that isn't already used in other parts of your workflow, to avoid unintended conflicts.
Using the Variable: Once you store the value in a variable, you can reference this variable in other parts of your workflow.
Storing an Expression:
Input an Expression: If you need to store a computed value, enter an expression in the field. This can include functions, mathematical operations, or other variables.
Select a Variable for the Expression: Choose the variable where you want to store the result of the expression.
Utilise the Variable in Your Flow: After storing the expression result in a variable, use this variable as needed throughout your workflow.
Recommendations
Always double-check that you're storing values in the correct variable to avoid overwriting important data.
Test your workflow after implementing the 'Store to Variable' block to ensure that the values are being stored and used as expected.
FAQs
1. Can I use a stored variable to share information with customers?
Absolutely! Stored variables can be used to share dynamic content with customers, such as discount codes, order numbers, or personalised messages.
2. Is there a limit to the number of variables I can use?
Yes in one block you can only store one variable and you can you use multiple such blocks, but be mindful of complexity.
Too many variables can make your workflow harder to understand and maintain.
3. What happens if I store an expression that contains an error?
We validate the expression and show an error message incase of invalid expression.
For further assistance or to raise feature requests related to Store to Variable, please contact [email protected].