Smart Defaults offer an advanced method of configuring this functionality.
Values used in Labels and Fix versions in this example refer to previously configured Static variables, so you can combine these two features together.
This chapter provides a complete list of smart expressions for Issue Templates for Jira.
Smart expressions are formulas used to trigger certain actions within an issue.
Smart defaults can refer to an active issue and its fields. Here’s the list of available smart expressions:
Smart expression | Description |
---|---|
issue.epic |
Returns the epic name |
issue.epic.key |
Returns the epic key |
issue.epic.status and issue.epic.status.name |
Displays the epic status |
issue.issueType.name |
Displays the issue type name |
issue.parent |
Returns subtask’s parent issue key |
issue.reporter.displayName |
Returns the name and surname of the reporter of current issue |
issue.customfield_id |
Displays the id of a custom field |
issue.field |
Displays the id of a field |
To set a parent with smart defaults you need to leave the field empty on the create screen.
Smart expression | Description |
---|---|
issue.fixVersions |
Used to access the values in an issue’s Fix Versions field (*) |
labels |
Returns Labels property |
subtasks.key |
Returns subtasks key |
subtasks.priority |
Returns subtasks priority |
(*) other ways to access the Fix Versions field:
issue.fixVersions.name
fixVersions.name.max()
fixVersions.name.max
fixVersions.max
fixVersions.min
fixVersions.average
fixVersions[0].name
Smart defaults can help you with defining users: initiator, reporter, assignee, creator. You can use the following properties as smart expressions:
Smart expression | Description |
---|---|
[user].displayName |
Returns user’s name and surname |
[user].emailAddress |
Returns user’s email |
[user].timeZone |
Returns user’s timeZone |
[user].accountId |
Returns user’s account ID |
The [user] placeholder can be replaced with a user, for example project.lead.displayName
, which will show the project leader’s name.
With smart defaults you can receive information about date and time. You can use the following smart expressions:
Smart expression | Description |
---|---|
now + 5d or now.plusBusinessDays(5) |
Adds a given number of days omitting weekends. Math operations are calculated in UTC. |
now - 5d or now.minusBusinessDays(5) |
Subtracts a given number of days omitting weekends. |
toBusinessDay |
Takes the given date, and returns the next business date |
now |
Displays current date and time |
now.format("yyyy-MM-dd") |
Returns current date and time with given format |
Smart expressions allows you to gain information about project, especially:
Smart expression | Description |
---|---|
project.lead |
Returns the project lead |
project.lead.displayname |
Displays the project lead |
project.lead.accountId |
Returns the lead’s account ID |
project.id |
Displays the project ID |
project.key |
Returns the key of the current project |
project.name |
Returns the project name |
project.projectTypeKey |
Returns the project key |
project.avatarUrls |
Returns project’s avatar URL |
You can use the following methods to access issue fields:
issue
- will access a field for which it is configured
issue.fix_versions
- provide short form of field name with _ instead of space in case you want to configure it for other field e.g. Affects Versions
issue.field("Fix versions")
- use field expression with an exact name if your field contains special characters
issue.customfield_10330
- use custom field key in case you have more than 1 field with the same name
If the Fix Versions field is set to 1.0.2 and 1.0.3 versions:
issue.field("Fix versions")
// returns
1.0.2, 1.0.3
With a now + 5d
expression you can set a relative date in date type fields. +5d
or -5d
is a shortcut for .plusBusinessDays(5)
or .minusBusinessDays(5)
.
As a source of the date you can use now
, issue properties like issue.created
, other date fields or inherited fields, for example, parent.due_date
.
Supported syntax:
[date] [+-] [dw]
d - business days, w - business weeks[date].plus[unit]
[date].miunus[unit]
Supported units:
Supported actions:
now + 5d now.plusDays(3)
issue.created + 5d issue.due_date.minusDays(2)
parent.due_date + 5d
variable("Launch date") + 5d
Smart defaults support multiselect. You can define more than one value for multiselect fields.
Simply separate values with a comma (,
).
Components = Backlog, Roadmap
The following fields are supported:
By using the parent
expression, you can easily configure nested (child) templates to inherit values provided in the parent.
This can be useful when you need to set the same component, version or labels in all epic’s issues and want to use the same template in different scenarios.
Just enter a field value in the Create issue dialog. All children created from the primary template inherit the given value.
To use the parent
accessor issues need to be in a parent-child relation, for example children of an epic or subtasks. Linked issues don’t have such a relation.
If you want to pass down values from your primary issue (issue from which the templating process starts), you can use the primaryIssue
accessor.
primaryIssue
- will access a field for which it is configured
primaryIssue.fix_versions
- provides a short form of a field name with _
instead of space in case you want to configure it for other field, for example, Affects Versions
primaryIssue.field("Fix versions")
- use a field expression with an exact name if your field contains special characters
primaryIssue.customfield_10330
- use a custom field key in case you have more than 1 field with the same name
With the expression variable("variable name")
you can use values provided with Dynamic variables in custom/system fields. You can refer variables in all children and linked issues.
This can be useful when you want to set the same value across the whole structure, and at the same time you want to use variables for the same value in different fields, for example as a part of a summary or description. This approach is much more flexible than using a simple parent expression.
Supported actions:
:user
type dynamic variable, all user type fields are supported, for example, assignee, reporter, user pickers:date
or :datetime
variable to a date or a datetime field type, for example, Due date, Start date, Date Picker, Date Time Picker, etc.Value of any field can be computed using vast Smart expressions.
Expressions that can be used depend on the type of field against which you are calculating the value, for example, a user field, like reporter, can be set to project lead by the project.lead
expression.
You can set a reporter to the project lead using - project.lead