Add global variable
Function: Add global variable
This action allows you to create a new piece of information (a "variable") that can be used throughout your entire application. Think of it like a temporary storage space for data that any part of your application can access. Once set, this variable can automatically replace placeholders on your pages, such as \{\{FIRSTNAME\}\}, with the value you provide. This is incredibly useful for personalizing content, displaying dynamic information, or sharing data between different parts of your application without complex connections.
Important Note: A placeholder like \{\{FIRSTNAME\}\} is not the same as the name of a UI element. You'll need to know the exact placeholder text used on your page or within a specific element to ensure this action works as expected.
Input
- Variable name (Text, Required): This is the unique label for your piece of information. It must be distinct across your entire application to prevent confusion or accidental overwrites. For example, you might use
UserName,OrderTotal, orCurrentDate. - Variable value (Any type of data, Required): This is the actual data you want to store under the chosen variable name. It can be text (like "John Doe"), a number (like 123.45), a date, a true/false value, or any other information your application handles.
Output
This action does not directly produce an output value that can be used in subsequent steps. Its primary effect is to make the defined variable and its value available for use throughout your application.
Execution Flow
Real-Life Examples
-
Example 1: Personalizing a Welcome Message
- Scenario: After a user logs in, you want to display their name on various pages.
- Inputs:
- Variable name:
LoggedInUserName - Variable value:
Sarah(This value would typically come from the user's login information)
- Variable name:
- Result: The application now knows
LoggedInUserNameisSarah. If any page or element has a placeholder likeWelcome, \{\{LoggedInUserName\}\}!, it will automatically displayWelcome, Sarah!.
-
Example 2: Storing a Calculated Discount
- Scenario: You have a complex calculation that determines a customer's discount, and you want to display this discount amount on multiple parts of the checkout process.
- Inputs:
- Variable name:
CustomerDiscount - Variable value:
25.00(This value would be the result of a previous calculation step)
- Variable name:
- Result: The application stores
CustomerDiscountas25.00. This value can then be displayed on an order summary page using a\{\{CustomerDiscount\}\}placeholder, or used in further calculations for the final price.
-
Example 3: Setting a User Preference for Dark Mode
- Scenario: A user toggles a switch to enable or disable dark mode for their application interface.
- Inputs:
- Variable name:
IsDarkModeEnabled - Variable value:
True(This value would come from the user's interaction with the dark mode toggle)
- Variable name:
- Result: The application remembers that
IsDarkModeEnabledisTrue. This can be used by your application's design logic to dynamically change the theme of the application for the current user, for instance, by checking the\{\{IsDarkModeEnabled\}\}placeholder or using it in conditional display rules.