Confluence replacement variables

Confluence replacement variables

When you run a sequence of actions using run, runFromList, runFromSql, runFromCsv, or any client-specific run action, you may need to reference information generated by earlier steps. Replacement variables allow you to dynamically reuse values—such as issue keys, page IDs, or usernames—across actions.

This guide explains how to use these variables, how the reference parameter helps retain values for later use, and what variables are available for different clients.


How variable replacement works

Before an action runs, the CLI replaces any variable placeholders in the format @<variable>@ with their corresponding values. For example, in a runFromList action, @entry@ refers to the current list item.

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

In client-specific scripts, replacement variables are often populated by actions that return specific data. For example:

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

Many create or get actions automatically set variables that you can use in subsequent commands. Some actions also support the reference parameter, which lets you persist a value and reuse it later—even after another action would otherwise overwrite it. This is useful when linking issues or managing multi-step operations.


Syntax and behavior

  • Replacement variables use the format: @<variable>@

  • Variable names are case-sensitive

  • The CLI only replaces variables within the scope of the same run block or a parent run block

  • Each runFromList action maintains its own variable scope

  • Use getReplacementVariableList to view available variables during execution

  • Use setReplacementVariableList to define custom replacement variables

  • Do not confuse replacement variables with substitution variables—they use different syntax and behavior


Confluence variables

The following variables are available when working with Confluence CLI actions:

Variable

Description

Available Since

Variable

Description

Available Since

@pageId@

Last created or referenced page ID (numeric)

@pageUrl@

URL of the last created or referenced page

@blogId@

Last created blog ID (numeric)

@blogUrl@

URL of the last created or referenced blog

@contentId@

Last referenced content ID (numeric)

5.3

@contentUrl@

URL of the last referenced content

@containerId@

ID of the last referenced container (numeric)

9.2

@space@

Last created or referenced space key

@spaceName@

Last created or referenced space name

5.2

@spaceUrl@

URL of the last created or referenced space

8.4

@title@

Last referenced content title

@attachment@

Name of the last created or referenced attachment

@attachmentId@

ID (numeric) of the last created or referenced attachment

@attachmentUrl@

URL of the last created or referenced attachment

8.4

@userId@

ID of the last created or referenced user

5.7, 9.0

@userKey@

Key of the last created or referenced user

8.6, 9.0

@userDisplayName@

Display name of the last referenced user

9.0

@question@

Title of the last created or referenced question

@questionId@

ID (numeric) of the last created or referenced question

@topic@

Name of the last created or referenced topic

@topicId@

ID (numeric) of the last created or referenced topic

@storageFormat@

Converted content from the last convertToStorageFormat action

@content@

Page source content from the last getPageSource action

6.3

@commentId@

Comment ID from runFromCommentList

6.6

@group@

Last referenced group name

6.9

@shortcut@

Name of the last created or referenced shortcut

7.0

@shortcutId@

Numeric ID of the last created or referenced shortcut

7.0

@shortcutUrl@

URL of the last referenced shortcut

8.4

@applicationLink@

Name of the last referenced application link

8.7

@applicationLinkId@

ID of the last referenced application link

7.7

@applicationLinkUrl@

URL of the last referenced application link

8.7


Common client variables

These variables are available across most CLI clients and scripts.

Variable

Description

Available Since

Variable

Description

Available Since

@entry@

Entry from the list parameter of the runFromList action

@entry2@

Entry from the list2 parameter of the runFromList action

@renderRequest@

Last result from the renderRequest action after findReplace processing

@server@

Server URL for the remote Atlassian application

9.0

@hosting@

Hosting type (server, cloud, or datacenter) from getServerInfo

9.3

@version@

Product version from getServerInfo

9.3

@runDate@

Timestamp when the run script starts. All references to @runDate@ in that run block share the same value

9.0

@file@

File path for the most recent get or get list action that used the file parameter

9.3

@fileSize@

File size (in bytes) from the most recent file-related action

9.3

@fileContent@

File content from the last file-related action (for files < 10MB)

9.3


Example usage

Here’s how you might use replacement variables in a script:

jira --action runFromList --list JIRACLI-101,JIRACLI-102 --common "--action getIssue --issue @entry@"

Or, to create a page and then use its ID:

confluence --action addPage --space DOC --title "Release Notes" --content "Version 9.0 released" confluence --action addLabel --id @pageId@ --labels "release-9.0"