Variables
A variable is a placeholder in the text of a template. When someone applies the template, the app replaces the variable with real data, such as today’s date or the name of the current user. The built-in variables are called System Variables. You can’t add your own.
How variables work
- A variable is a dollar sign followed by its name in capital letters, with no closing character, for example
$TODAY. Names are case-sensitive. Text that doesn’t match a name exactly stays as typed. - Variables work only in text fields: Summary, Description, and custom fields of the types Short text (plain text only) and Paragraph (supports rich text). In other fields, the text stays as typed.
- The app takes the values when the template is applied, not when you design it. The date, the user, and the data of the parent work item are the ones at that moment.
- If the app can’t find the data, it removes the variable. For example, the parent work item has no assignee, or the email address of the user isn’t available.
- If a value would make the text longer than the field allows, the app removes that variable and leaves the rest of the text unchanged. The limit is 255 characters for Summary and short text fields.
Each group of variables works in these templates:
| Variable group | Parent template | Child template |
|---|---|---|
| Date and time | Yes | Yes |
| Current user | Yes | Yes |
| Parent work item | No | Yes |
For example, the Summary Weekly report, week $WEEK_OF_YEAR becomes Weekly report, week 47 in week 47 of the year.
Date and time variables
Dates and times use the formats configured in Jira, in the time zone and language of the user who applies the template.
| Variable | Replaced with |
|---|---|
$TODAY | Today’s date. |
$TOMORROW | Tomorrow’s date. |
$NEXT_WEEK | The first day of next week. The first day of the week depends on the language and region of the user. |
$NEXT_MONTH | The first day of next month. |
$CURRENT_TIME | The current date and time. |
$WEEK_OF_YEAR | The number of the current week. |
Current user variables
| Variable | Replaced with |
|---|---|
$CURRENT_LOGGED_USER_NAME | The display name of the user who applies the template. |
$CURRENT_LOGGED_USER_MAIL | The email address of that user. |
Parent work item variables
You can use these variables only in a child template. In a parent template, the app doesn’t replace them and they stay as typed. The parent work item is the work item directly above the one the app creates. For a sub-task of a child work item, it is that child work item.
| Variable | Replaced with |
|---|---|
$PARENT_ISSUE_KEY | The key of the parent work item. |
$PARENT_SUMMARY | Its summary. |
$PARENT_DESCRIPTION | Its description. |
$PARENT_REPORTER | Its reporter. |
$PARENT_ASSIGNEE | Its assignee. |
$PARENT_PRIORITY | Its priority. |
$PARENT_DUE_DATE | Its due date. |
For example, the Summary of a child template Test: $PARENT_SUMMARY becomes Test: Login page when the parent work item has the summary Login page.
In a description or paragraph field, put $PARENT_DESCRIPTION alone on its own line. The template can’t be saved otherwise.
What you get in each field type
- In rich text fields (Description and paragraph fields), the app inserts Jira’s own elements. The date variables become dates, the user names,
$PARENT_REPORTER, and$PARENT_ASSIGNEEbecome mentions, and$PARENT_ISSUE_KEYbecomes a link. Other values become text. - In Summary and short text fields, every value is plain text.
When the app replaces variables
- When a user applies a template on the Create work item dialog, the work item view, a transition screen, or the customer portal, the app replaces the date and time variables and the current user variables immediately.
- The app replaces the parent work item variables, and all other variables in child templates, when it creates the child work items.
- When the REST API or Jira Automation applies a template, the same rules apply, and the app replaces the variables on the server.