To set values for inputs that appear repeatedly in multiple chains or commands within a single chain, you can use variables. Rather than input the same value in multiple chains or commands, you can define it as a variable, and manage its value in one location.
- Workspace variables define values that appear across multiple chains.
- Chain variables define values that appear in multiple commands of a chain and may change frequently.
- Dynamic variables define values to set when a chain runs or during the execution of a chain, such as based on an earlier command's output.
Manage your workspace's variables
From your workspace, you can define the variables used by multiple chains.
- From Chains , click Workspaces and Edit.
- Under Variables, click Add Variable.
- To help identify the variable, enter its name and, if necessary, default value.
Note: You can update a variable's default value from an environment, such as to change the input based on whether the chain runs in DEV or PROD.
- To enable only admins to view the variable's value, select Encrypt.
- Click Save.
After you add a variable to your workspace, you can edit its name, value, or encryption as necessary. To remove a variable from the workspace, click its Delete.
Manage a chain's variables
For values that appear in multiple commands within a chain and change frequently, add them as variables for the chain.
Note: A chain can have up to 100 variables.
- In the chain, click Chain Settings.
- Under Variables , click Add .
- Enter a unique name to help identify the variable and its intent.
- Enter the default value for the variable.
- To enable only admins to view the variable's value, select Encrypt.
- Click Save.
To update a variable, click Edit for the chain, and adjust the value under Variables.
To remove a variable you no longer need, click Delete
.Manage a chain's dynamic variables
To set values when the chain runs, or to base values on another command's output, add them as dynamic variables for the chain:
- In the chain, click Chain Settings.
- Under Dynamic Variables , click Add .
- Enter a unique name to help identify the variable and its intent.
- Enter the initial value for the variable, and click Save.
Note: To set the dynamic variables' values when a chain starts to run, start it with a Runtime Inputs trigger event. To pause a chain to define a dynamic variable's value before proceeding to the next step, add a Set Dynamic Chain Variables event.
To remove a variable you no longer need, click Delete
.Use variables as command inputs
To use variables as text-based inputs for a command:
- From the chain, select the command to use the variables.
- In the text-based input to use a variable, click Variable
Note: To concatenate multiple variables within an input, select the variables to use, and then enter any text to appear before or after each.
, and select the variable.
- Click Save.
Note: To modify or format a variable for use as a command input, apply a variable transformation.
Runtime variables
To include data related to when a chain runs, you can use several runtime variables.
Variable | Description |
---|---|
Chain.Environment | The environment of the currently running chain |
Chain.ExecutionDateTime | The date and time of when the chain starts |
Chain.ExecutorId | The numeric ID of the currently running chain |
Chain.Id | The numeric ID of a chain in the non-running state |
Chain.Name | The name of the currently running chain |
Chain.PreviousExecutionDateTime | The date and time of when the chain last ran |
Chain.URL | The unique URL of the currently running chain |
Chain.Workspace | The workspace of the currently running chain |
Command.ExecutorId | The numeric ID of the currently running command |
Command.Id | The numeric ID of a command in the non-running state |
Command.Name | The name of the currently running command |
Command.URL | The unique URL of the currently running command |
Runner.InstallationDirectory | The installation directory for the chain's GroundRunner; null if a CloudRunner is used |
System.Date | The current system date |
System.DateTime | The current system date and time |
User.Email | The email address of the collaborator who ran the chain |
User.Id | The ID of the collaborator who ran the chain |
User.Name | The name of the collaborator who ran the chain |