Working with Variables
Variables are the backbone of dynamic workflows. They allow data to flow between tasks, enabling you to build intelligent automation that responds to real-world inputs and conditions.
What are Variables
Variables are dynamic values that flow through your workflow during execution. Instead of hardcoding values into each task, you use variables to pass information from one step to another. This makes your workflows flexible, reusable, and capable of handling different scenarios without modification.
When a workflow executes, the system resolves all variable expressions at runtime, replacing them with actual values from the execution context.
Three Types of Variables
1. Input Variables (Workflow Parameters)
Input variables are parameters defined at the workflow level. They represent the initial data your workflow needs to start execution.
Characteristics:
- Defined in the workflow settings before building
- Values are provided when the workflow executes
- Can have default values for optional parameters
- Each variable has a name, type, and description
Common examples:
borrower_id- The identifier of a borrower to evaluateloan_amount- The requested loan amountapplication_date- When the application was submitted
Syntax:
Input variables define the contract between your workflow and its callers. Anyone executing your workflow must provide values for required input variables.
2. Source Variables (From AltData Enrichment)
Source variables contain data retrieved from external data sources through AltData Enrichment tasks. When you add an enrichment task to your workflow, it queries external services and makes the results available as variables.
Characteristics:
- Created automatically by AltData Enrichment tasks
- Contain data from credit bureaus, government registries, and other external sources
- Available to all subsequent tasks in the workflow
- Structure depends on the specific data source queried
Syntax:
3. Created Variables (Computed Values)
Created variables are values you define within the workflow using Set Variable or Compute Variables tasks. These allow you to transform, combine, or calculate new values from existing data.
Characteristics:
- Created by Set Variable or Compute Variables tasks
- Can contain static values, calculations, or transformations
- Useful for intermediate calculations and data formatting
- Help organize complex logic into manageable pieces
Examples:
- Calculating a debt-to-income ratio from fetched data
- Formatting a name by combining first and last name fields
- Creating a flag based on business rules
Managing Variables
Opening the Elements Panel
Variables are managed through the Elements Panel at the bottom of the canvas:
- Locate the Elements Panel at the bottom of the workflow canvas
- Click on the Variables tab to see all workflow variables
- The panel displays input variables, source variables, and created variables
Adding Input Variables
To add a new input variable:
- Open the Elements Panel and select Variables
- Click the Add Variable button
- Configure the variable properties:
- Name: A unique identifier (use snake_case, e.g.,
borrower_id) - Type: The data type (string, number, boolean, object, array)
- Default Value: Optional value used if none is provided
- Description: Help text explaining the variable's purpose
- Name: A unique identifier (use snake_case, e.g.,
Use clear, descriptive names for your variables. Names like borrower_id or loan_amount are much better than id or amount because they clearly indicate what data the variable holds.
Editing and Deleting Variables
- Click on any variable in the list to edit its properties
- Use the delete button to remove variables no longer needed
- Changes to variables may require updates to tasks that reference them
Using Variables in Tasks
The Advanced Tab
Most task configuration happens in the Properties Panel. To map variables to task inputs:
- Select a task on the canvas
- Open the Properties Panel on the right side
- Navigate to the Advanced tab
- Find the input field you want to configure
- Enter a variable expression or use the variable picker
Variable Picker
The variable picker provides a visual way to select variables:
- Click the variable icon next to an input field
- Browse available variables organized by source
- Click a variable to insert its expression
- The picker shows the variable type and current value (if available)
Manual Expression Entry
You can also type variable expressions directly:
Variable expressions must match exactly. A typo in the variable name or path will cause the workflow to fail at runtime. Always verify your expressions using the variable picker when possible.
Variable Syntax Reference
Workflow Input Variables
Access input variables defined at the workflow level:
Examples:
Task Outputs
Access the output produced by a previous task using its alias:
Examples:
Nested Paths
Access nested properties within complex objects using dot notation:
Examples:
Task Inputs (For Debugging)
Access the input values that were passed to a task:
This is primarily useful for debugging to verify what values a task received.
Practical Walkthrough: Creating and Using Variables
Let's walk through a real example together. By the end, you'll understand how to create a variable, use it in your workflow, and pass information between tasks.
The Scenario
Imagine you're building a workflow to look up customer information. You want the workflow to:
- Accept a customer ID when it runs
- Look up that customer's details
- Save the customer's name for use later in the workflow
This is a common pattern - you tell the workflow which customer to work with, and it handles the rest automatically.
Step 1: Create Your Input Variable
First, let's create a variable that will hold the customer ID.
- Look at the bottom of your canvas and find the Elements Panel
- Click on it to expand it, then select the Variables tab
- Click the Add Variable button
- Fill in the form:
- Name: Enter
customer_id(use underscores instead of spaces) - Type: Choose "string" from the dropdown
- Description: Enter something helpful like "The ID of the customer to look up"
- Name: Enter
- Click the checkmark to save
You'll see your new variable appear in the list. This variable is like a placeholder - when someone runs the workflow, they'll provide the actual customer ID, and the workflow will use that value.
Step 2: Use the Variable in a Task
Now let's use this variable. We'll add a task that fetches customer data.
- Drag an HTTP Request task onto your canvas
- Click on the task to open the Properties Panel on the right
- Find the URL field and click inside it
- Here's where the magic happens: click the variable icon (it looks like
{x}) next to the field - A picker window opens showing all available variables
- Look under Workflow Variables and click on
customer_id - The variable appears in your URL field, surrounded by curly braces
The URL might now look something like:
Those curly braces tell the workflow: "When you run, replace this with the actual customer ID."
Step 3: Pass Data to the Next Task
When the HTTP task runs, it will return the customer's information. Let's grab the customer's name from that response.
- Add a Set Variable task to the canvas (you'll find it in the Utilities category)
- Draw a connection from your HTTP task to this new task
- Click on the Set Variable task to configure it
- For Variable Name, enter
customer_name - For the Value, click the variable icon again
- This time, look under Task Outputs - you'll see your HTTP task listed
- Expand it and navigate through the data until you find the name field
- Click to select it
The variable picker makes this easy because it shows you exactly what data is available from previous tasks.
Step 4: Test It Out
Let's make sure everything works:
- Click the Play button to run a test
- A form appears asking for your input variable - enter a real customer ID
- Click Execute and watch your workflow run
- Click on each task to see what happened:
- Check the HTTP task to see the URL that was used (your customer ID should be in there)
- Check the Set Variable task to see the customer name that was captured
Tips for Success
Use the variable picker whenever possible. It shows you exactly what's available and helps you avoid typing mistakes. Manually typing variable names is the most common source of errors.
Check the Preview tab when debugging. If something isn't working, click on a task and look at the Preview tab. It shows you exactly what data that task produced, which helps you understand what paths are available.
Give your variables clear names. Names like customer_id and loan_amount are much easier to work with than id or amt. When you come back to edit the workflow later, you'll thank yourself.
If you're not sure what data a task produces, run the workflow once with test data. Then click on the task and check the Preview tab to see the actual results. This makes it much easier to find the right variable paths.
Best Practices
Naming Conventions
- Use
snake_casefor variable names:borrower_id,loan_amount - Be specific:
primary_borrower_idis better thanid - Group related variables with prefixes:
borrower_name,borrower_email
Variable Organization
- Keep input variables to the minimum required
- Use created variables to store intermediate calculations
- Document complex variable transformations with Comment tasks
Error Prevention
- Always provide descriptions for input variables
- Set default values for optional parameters
- Test variable references with sample data before publishing
Variables are resolved at runtime by the backend. The Workflow Builder validates syntax but cannot verify that a variable path exists until the workflow actually executes with real data.