Links field
The Issue Link Guard – Links field lets users manage all links of an issue from the issue's fields and choose links while they create an issue. It follows the project's link rules.
Add the field
As a Jira administrator:
- In Jira admin settings, select Work items, then Fields.
- Create a custom field of the type Issue Link Guard – Links. Give it any name.
- Add the field to the screens the project uses: the edit and view screens, and the create screen if users should choose links while creating issues.
- Optionally, in the field's context configuration, set Text shown on the issue view (up to 100 characters). Leave it empty to show the default text, "Manage links", in each user's language.
A field appears on issues only when it's on the project's screens. Creating the field alone isn't enough.
Manage links on the issue view
On the issue view, the field shows a short text, "Manage links" by default. Select the text to open the link window, the same window the side panel opens. The window shows all links of the issue as tiles grouped by link type. You add links with the search, remove them with ×, and save the changes with Save (+N / −M).
Like any Jira field, the field can be edited only by users who can edit the issue.
When you close the field after saving changes, the issue page reloads once, so Jira's own Linked work items section shows the new links.
Choose links on the create screen
On the create screen, users can choose links before the issue exists. To choose links for a new issue:
- In the field, choose a link type.
- Search for an issue and pick it. It's added as a tile.
- Repeat for more links.
- Select Create.
The links are created a few seconds after the issue is saved. Because no user is signed in at that point, the app's account creates them, after checking:
- the project's link rules for the person who created the issue
- that this person can view the target issue
- that this person has Link Issues, if the project doesn't use the technical account
If a link can't be created, the new issue's activity log shows a warning entry, "The link … selected by … when creating this issue was not created", followed by the reason.
A Jira Automation rule can fill the field too, see Set links from Jira Automation.
Set links from Jira Automation
An automation rule (a flow in the new automation editor) can fill the Links field when it creates an issue. A few seconds after the issue is created, the app creates the links, as it does for links chosen on the create screen.
Unlike a picker field, the Links field has no fixed link type. That's why each entry in the field names the link type and its direction, not only the issue to link to. If all links from a rule use one link type and the issues match one JQL filter, a picker is simpler, because its entries are only issue keys.
How an entry is built
An entry is text made of three parts separated by colons:
<link type ID>:<direction>:<issue key>
| Part | What to enter | Example |
|---|---|---|
| Link type ID | The number Jira gives the link type. See Find the field and link type IDs. | 10000 (Blocks) |
| Direction | outward or inward. It picks which phrase of the link type describes the new issue. |
inward |
| Issue key | The issue to link the new issue to. | WEB-1 |
Every link type has two phrases. For example, Blocks has "blocks" (outward) and "is blocked by" (inward). The direction is always seen from the new issue. In these examples, the rule creates MOB-10:
| Entry | Link on MOB-10 |
|---|---|
10000:outward:WEB-1 |
MOB-10 blocks WEB-1 |
10000:inward:WEB-1 |
MOB-10 is blocked by WEB-1 |
10003:outward:WEB-4 |
MOB-10 relates to WEB-4 |
For a link type with the same phrase in both directions, such as Relates, use outward.
Find the field and link type IDs
As a Jira administrator:
- To find the field's ID, in Jira admin settings, select Work items, then Fields, and select the field's name. The page address ends with
fieldId=customfield_and a number, for examplefieldId=customfield_10075. - To find a link type's ID, in Jira admin settings, select Work items, then Work item linking, and select Edit next to the link type. The page address ends with
id=and the number, for exampleid=10000.
Without access to Jira admin settings, you can still see the link type IDs. While signed in to Jira, open https://<your-site>.atlassian.net/rest/api/3/issueLinkType in your browser. The page lists each link type with its id, name, outward, and inward phrases.
Link type IDs can differ between Jira sites, so check them on your site instead of copying the numbers from this page.
Set the field in a rule
The Links field isn't listed among the fields of the Create work item action, so you set it with JSON.
To set the Links field in a rule:
- Find the field's ID and the IDs of the link types you need.
- In the rule's Create work item action, select More options.
- In Additional fields, enter the JSON from one of the examples below, with your IDs.
- Save the rule.
The field must be on the create screen of the project where the rule creates the issue. Its value is always a list of entries, also for one link.
If the rule creates the issue in a different project from the one it runs in, or looks up issues in another project, the rule's scope must include all of these projects. Only a Jira administrator can create rules for several projects.
Create fixed links
To always create the same link, put one entry in double quotes and square brackets:
{
"fields": {
"customfield_10075": ["10000:inward:WEB-1"]
}
}
To create several links, separate the entries with commas. The entries can use different link types and directions:
{
"fields": {
"customfield_10075": ["10000:inward:WEB-1", "10003:outward:WEB-4"]
}
}
The new issue is blocked by WEB-1 and relates to WEB-4.
Link to the issue the rule runs on
Inside the quotes, use the smart value {{triggerIssue.key}} instead of the key:
{
"fields": {
"customfield_10075": ["10000:outward:{{triggerIssue.key}}"]
}
}
A rule that runs on MOB-5 creates an issue that blocks MOB-5. One list can mix entries with fixed keys and entries with smart values.
Link to issues found by a query
Find the issues with a Lookup work items action placed before Create work item. Then build one entry for each issue found:
{
"fields": {
"customfield_10075": [
{{#lookupIssues}}"10000:inward:{{key}}"{{^last}}, {{/}}{{/}}
]
}
}
The smart values in the list work like this:
{{#lookupIssues}}and the last{{/}}repeat everything between them once for each issue found.{{key}}is the key of that issue.{{^last}}, {{/}}adds a comma after each entry except the last one.
When Lookup work items finds WEB-2 and WEB-3, the rule sends ["10000:inward:WEB-2", "10000:inward:WEB-3"], and the new issue is blocked by WEB-2 and WEB-3.
The smart value {{lookupIssues.key.asJsonStringArray}} used for picker fields doesn't work here, because it returns only the keys, without the link type and direction.
Checks for the rule's actor
The app treats the rule's actor as the person who created the issue. By default, the actor is Automation for Jira; you can change it in the rule's Settings panel. The app checks the same conditions as for links chosen on the create screen.
For example, if the project's link rules don't allow Duplicate for the actor, the entry 10002:outward:WEB-1 isn't created. The new issue's activity log shows "The link duplicates WEB-1 selected by Automation for Jira when creating this issue was not created", with the reason "You are not allowed to use this link type in project MOB." The rule's audit log doesn't show this, because the app creates the links after the rule has created the issue.
An entry with a link type ID that doesn't exist on the site, or with an issue the actor can't see, is refused the same way, with a reason in the activity log. If a link is missing and the activity log says nothing about it, see A link set by an automation rule is missing.
For what rules can't do with the field, see Limits and known limitations.
Limits
| What | Limit |
|---|---|
| Links in the field when an issue is created, on the create screen or by a rule | 100 |
| Text shown on the issue view | 100 characters |