Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleAvailability
  • 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

Excerpt

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:

  1. Blocks
  2. Relates
  3. 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.

Info

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.

linkTypeNamestringNoSpecifies the link type.
directionnumberNo

-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:

  1. Is blocked by "TUT-3 LinkedIssue3"
  2. Relates to "TUT-2 LinkedIssue2"

Image Added


If we run the following SIL™ code:

Code Block
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:

Code Block
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:

Code Block
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

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "jira_links_routine"
labelsjira_links_routine