Use variable references in run actions

Use variable references in run actions

When you run a series of actions using any of the run commands—such as run, runFromList, runFromSql, runFromCsv, or client-specific run actions—you might need to reference values generated during the execution of earlier actions. This guide explains how variable references work in the Atlassian Command Line Interface (ACLI), how to use them, and when to apply the reference parameter to retain specific values across multiple actions.

The availability of specific variables depends on both the type of actions you run and the version of the ACLI client you're using. Newer versions typically support more variables. If you need a variable that isn't currently available, or if you notice an action that could set a variable but doesn’t, consider raising an issue to request it.

Understand variable references

ACLI supports variable substitution using the @<variable>@ syntax. During execution, ACLI replaces these placeholders with values generated at runtime. Variables are typically defined by the current or most recently executed action.

For example, in a runFromList action, the placeholder @entry@ is replaced by each item in the list:

jira --action runFromList --list PROJECTA,PROJECTB --common '--action getProject --project @entry@'

This command runs getProject twice: once with PROJECTA and once with PROJECTB.

Use the reference parameter to retain values

By default, ACLI variable references point to the last value generated. However, when running sequences where later actions might overwrite earlier values, you can use the reference parameter to store and recall a specific value.

This is especially helpful in more complex scenarios, such as:

  • Linking a new Jira issue to a previously created one

  • Reusing a generated project key or user ID later in the script

For example, when you want to remember a Jira issue key generated earlier, set a reference to it:

jira --action createIssue --project TEST --summary "Sample issue" --reference issueRef

You can then use @issueRef@ in subsequent commands to refer back to this issue, even if other actions generate new keys.

Use case examples

Example 1: runFromList with basic variable reference

jira --action runFromList --list PROJECTA,PROJECTB --common '--action getProject --project @entry@'

In this example, @entry@ refers to each item in the list (PROJECTA and PROJECTB) and substitutes it in the getProject action.

Example 2: runFromProjectList with built-in variable

jira --action runFromProjectList --common '--action getProject --project @project@'

Here, @project@ is a client-specific variable available during runFromProjectList. It is automatically populated for each project in the list.

Client-specific variables

Many ACLI variables are specific to the client you’re using (for example, Jira or Confluence). In some cases, client-specific actions generate variables that you can use in subsequent steps.

For example, when creating projects or issues based on a template, the client might return a project key or issue ID that can be referenced in the next action. These variables allow you to build more dynamic and automated workflows without hardcoding values.

What to do if a variable is missing

If you’re building a workflow and need a variable that isn’t currently supported, or if a certain action doesn’t set a variable you expected, let us know! You can raise an issue to suggest adding new variable support.