Variables
When working with macros, triggers, and auto actions, you can insert values from the issue fields into a comment, formula, or HTTP request using variables.
Add variable
-
Create a macro, trigger, or auto action.
-
Click Add variable in the action block of the trigger or auto action. In the case of a macro, add a variable to the message.
-
Choose the field from the list. When the action is executed, the field value will replace the variable in the text. You can also insert issue parameters that are missing in the variable list. For this, enter the variable name into the text.
The list shows variables for all the fields available in Yandex Tracker. If you select a variable not used in a queue or issue for a field, the value will not be substituted.
Variable types
The variable names assigned to issue fields, have the format: {{issue.<field_key>}}
. To get a specific parameter of an issue field, use the following format: {{issue.<field_key>.<parameter>}}
.
Full list of issue fields: https://tracker.yandex.com/admin/fields
User attributes
You can use default variables to get the user's first and last name. To do this, specify variables in the following format:
-
{{issue.<role>}}
, where<role>
is the name of the issue field that specifies the user:assignee
: Issue assignee.author
: Author.followers
: Followers.access
: Users from the Access field.
-
{{currentUser}}
: Current user who executed the macro or performed the action that fired the trigger.
To get specific user attributes, specify a variable in the following format:
{{issue.<role>.<attribute>}}
{{currentUser.<attribute>}}
Where <attribute>
defines the attribute:
login
: Login.firstName
: First name.lastname
: Last name.uid
: ID in Yandex Tracker.email
: Email address.passportUid
: ID in the Yandex 360 for Business organization and Yandex ID.
Starting October 1, 2023, the default user ID type changed from passportUid
to uid
. We recommend that you clearly specify the user ID type when performing integration.
For example, you can retrieve the email addresses of all issue followers using the {{issue.followers.email}}
variable.
Usernames that only contain numbers may be interpreted incorrectly when executing requests to Yandex Tracker. In the event of an error, we recommend using the uid
attribute instead of the login
one.
Additional issue parameters
Some issue parameters are not displayed in fields, but you can get their values using variables as well:
Variable | Value |
---|---|
{{issue.parent}} |
Parent issue |
{{issue.previousStatus}} |
Previous issue status |
{{issue.previousQueue}} |
Previous issue queue |
{{issue.checklistDone}} |
Number of completed items from the checklist |
{{issue.votes}} |
Number of votes for the issue |
{{issue.sprint.id}} |
Sprint ID associated with the issue |
Local fields
The variable names assigned to local issue fields have the {{issue.local.<field_key>}}
format.
Date and time modifiers
By default, the date and time is transmitted as DD month YYYY
, e.g., 07 december 2021
. For other formats of date and time, use modifiers:
iso8601
: ISO 8601 format.unixEpoch
: Unix Time format.date
: Writing only date for the fields transmitting date and time.
Here are the examples of variables with date and time modifiers:
Variable | Value | Notation format |
---|---|---|
{{currentDateTime.iso8601}} |
Current date and time in ISO 8601 format | YYYY-MM-DDThh:mm:ss.sssZ |
{{currentDateTime.unixEpoch}} |
Current time in Unix Time format | 1638735223000 |
{{currentDateTime.date}} |
Current date | 06 december 2021 |
{{issue.start.iso8601}} |
Issue start date in ISO 8601 format | YYYY-MM-DD |
{{issue.start.unixEpoch}} |
Issue start date in Unix Time format | 1638855321000 |
JSON modifiers
Some fields can accept multiple values. To retrieve or send values from such fields, for example, in HTTP requests, convert them to JSON format. For this, add .json
to the variable name.
Examples of variables in JSON format:
Variable | Value | Notation format |
---|---|---|
{{issue.summary.json}} |
Issue name | "Issue name" |
{{issue.description.json}} |
Problem description | "Description" |
{{issue.tags.json}} |
Tags | ["tag1","tag2"] |
{{issue.<role>.login.json}} |
User login (for the author and assignee fields) |
"ivan-ivanov" |
{{issue.<role>.uid.json}} |
User ID (for the author and assignee fields) |
88******** |
{{issue.<role>.login.json}} |
Logins of users (for the followers and access fields) |
["ivan-ivanov", "user3993"] |
{{issue.components.display.json}} |
Components | ["component1","component2"] |
{{issue.<role>.passportUid.json}} |
User IDs Yandex 360 for Business organization and Yandex ID (for the followers and access fields) |
[88********, 55********] |
{{issue.<role>.uid.json}} |
User IDs (for the followers and access fields) |
[88********, 55********] |
{{issue.sprint.id.json}} |
Sprint IDs associated with the issue | [12****, 34****] |
Tracker supports transmitting values in JSON format for simple field types that have such formats as string, number, and arrays of strings or numbers. The Object field type is not supported. For example, the {{issue.author.json}}
variable will not work. Instead, you can use a variable to retrieve a simple field attribute: {{issue.author.login.json}}
.
URL encoding modifiers
To use field values in URLs, you first need to convert them to a URL-safe format. To do this, append a URL encoding modifier to the variable name:
.urlEncodeUTF8
: Encodes characters using theUTF-8
standard..urlEncodeUTF16
: Encodes characters using theUTF-16
standard.
Here are a few examples of variables with URL encoding modifiers: {{issue.department.urlEncodeUTF8}}
, {{issue.assignee.urlEncodeUTF16}}
.
Comments
Using variables, you can get some attributes of the issue comments. These variables have the {{<comment_type>.<attribute>}}
format, where <comment type>
is selected depending on the author (user or robot), and <attribute>
is the comment's parameter.
The possible values for <comment_type>
are:
userComment
: Comment from the current edit operation. If a user has made more than one comment, the first one will be considered.generatedComment
: Comment generated automatically as a result of a fired trigger or auto action.
Use the parameters below to get comment details:
Variable | Value |
---|---|
{{<comment_type>.id}} |
Comment ID |
{{<comment_type>.text}} |
Text of the comment |
{{<comment_type>.author}} |
Comment author |