Availability
- This routine is available starting with SIL Engine™ 2.5 for Jira 5.x.
- This routine is available for Jira server and cloud deployment options.
Syntax
linkedIssues(issueKey, [[linkTypeName], [direction]]);
Alias
getLinkedIssues (issueKey, [[linkTypeName], [direction]])
Description
Returns an array with the Issue keys linked with the specified one.This routine searches for all the linked issues with the one given as argument (parameter) and builds an array that contains them. The second parameter [linkTypeName] is optional and represents a searching filter that selects only those issues that have a certain relation (link type) with the argument issue.
The Issue types that can be given as arguments are:
- Blocks
- Relates
- Clones
But also other Issue links can be defined. To add new link type follow the tutorial from https://confluence.atlassian.com/display/JIRA/Configuring+Issue+Linking. It can be used to find connections between different issues.
The third parameter [direction] is optional and it is used to specify whether to retrieve inward links or outward links.
The [direction] parameter is available starting with version 2.5.8 of SIL Engine™.
Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
issueKey | string | Yes | Specifies a string representing the key of the issue. |
linkTypeName | string | No | Specifies the link type. |
direction | number | No | -1, 0, 1 :Negative means inward links. Positive means outward links. Use zero to get both outward and inward links. |
Return type
an array of strings
The return value represents a list with all issues (issue keys) that are linked with the argument.
Example
A good way to understand the idea of this routine is by using an example, so:
Let's consider the following three issues: "TUT-1", "TUT-2" and "TUT-3".
The issue "TUT-1" has the following links:
- Is blocked by "TUT-3 LinkedIssue3"
- Relates to "TUT-2 LinkedIssue2"
If we run the following SIL™ code:
return linkedIssues("TUT-1","Blocks");
The result will be an array with one element: "TUT-3", because TUT-3 blocks the resolving of the "TUT-1" issue.
For the above example you will get the same result by running the following code:
return linkedIssues("TUT-1", "Blocks", -1);
"is blocked by" represents the inward description for the "Blocks" link type.
But if we run the following code:
return linkedIssues("TUT-1");
The result will be an array with two elements: "TUT-3|TUT-2", because both issues are linked with "TUT-1".
See also