Add linked issues into a structure using Jira Automation

Add linked issues into a structure using Jira Automation

Overview

The Jira build-in automation can help you to simplify routine tasks. This article describes the rule setup a easeRequirements tree structure using existing issue link relations.

Use Case:

  • A set of issues are already linked from e.g. children to parents

  • The parent is already added to the tree structure

  • All children issues following a certain link relation should be added to the tree

  • Interrate over many levels to get all children into the structure

 Instructions

To configure rules for automation, you need to be a Global or Project administrator.

  • For a global rule, go to Jira Settings > System > Global Automation.

  • For a project-specific rule, go to Project Settings > Automation.

To interrate over all levels of link relations, the main rule must be called recursive. To do so, an trigger is necessary, in this example case a change on the issue already in the tree and each new added issue.

The trigger of the recursive call is done by following automation:

Jira Authentication

The automation solution uses a REST API web request relying on basic authentication. Please see the notes and restrictions details there.

Trigger to start Iteration

Follow the steps below to set up a rule for an initial start of the recursive loop.

Step

Action

Explanation

Step

Action

Explanation

Create a new rule

Select the Create rule button.

 

Create a trigger for the rule

Select the trigger Manual trigger from issue in section Issue Triggers.

The rule is triggered from the issue in the requirement tree. If this issue is not in the tree, the processing will fail.

Get Target Project Tree

Prompt for input when this rule is triggered

image-20250331-133526.png

 

User need to input the key of the project tree where the issue is currently located. There is no option to identify currently selected project by the code.

Could be skipped, if issues always in same project tree as the belong to

Set issue Property

 

Select Set entity property

image-20250331-133626.png

 

Store the entered value of the target project key into the issues property:

image-20250331-134224.png

 

Select Edit issue

image-20250331-133702.png

 

Use any field to trigger the execution of the rekursive rule. E.g. Fill up the Labels field with easeReq

  • Label must exist in the system before usage

    • Label must be removed from all issues after full processing (bulk edit)

Enable the rule

Provide a name for the rule and then enable it by selecting Turn on rule.

 

Recursive adding issue to tree

Follow the steps below to set up a rule. This rule will be executed as often the defined criteria is identified, in the example we set the Labels field to easeReq.

To avoid endless loops over the issues by wrong related issues, do not clear off the Labels field within the automation.

Step

Action

Explanation

Step

Action

Explanation

Create a new rule

Select the Create rule button. Set flag

image-20250331-134845.png

 

Create a trigger for the rule

Select the trigger Field value changed in section Issue Triggers.

image-20250331-134921.png

 

The rule is triggered when one or more fields of an issue are changed.

Monitor the change of the labels field of the edit screen.

Verify change condition

Select IF: Issue fields condition

image-20250331-135031.png

 

Verify if the label includes the expected value.

Verify condition

Select: IF: {{smart values}} condition

image-20250331-135227.png

Verifiy if the property easeReq is not empty.

It should include the target tree project key where to add the issues.

Store target project key

Select Create variable

image-20250331-135547.png

 

Copy the property easeReq into a smartvalue for easier handling.

image-20250331-135756.png

 

Store current issue key

Select Create variable

image-20250331-135831.png

 

Store the current issue key for the below web request.

image-20250331-135919.png

 

Start iterating over the linked issues

Select FOR EACH: Add a branch

image-20250331-135958.png

 

Select the Branch rule / related issues option for linked issues, select the desired issue link types, e.g. trace to

image-20250331-140209.png

 

Add REST API web request

Select the action Send web request

image-20250331-141222.png

 

Web request URL: Use https://<SERVER LOCATION>.r4j-cloud.easesolutions.com/rest/api/1/tree/projects/{{targetProjectKey}}/items, where targetProjectKey is the smart variable of the target project as defined above.

  • Details of the request can be found at easeRequirements Cloud REST API Reference.

  • With data residency feature in place, your <SERVER LOCATION> must be specified. Check with the Jira system admin for the correct location.

HTTP method: Post

Web request body: Custom data

Custom data value:

{ "id": null, "jiraIssueId": null, "jiraIssueKey": "{{targetFolderKey}}", "items": [ { "jiraIssueId": null, "jiraIssueKey": "{{issue.key}}", "position": 0 } ] }

Note how the following values are set in the data value:

  • jiraIssueKey: The value is the smart variable targetFolderKey defined above.

  • items:

    • issue.key: The value is a variable containing the key of the new issue.

    • position: Use 0 to insert it in the last position.

Headers: Add the following two key/value pairs:

  • key: X-Atlassian-Base-Url

  • value: Your Jira cloud server URL (e.g. https://mycompany.atlassian.net/)

  • key: Authorization

  • value: your basic authentication hash key, e.g. Basic ZnJlZDpmcmVk - see Jira Authentication.

Example of headers:

image-20240311-141217.png

Set values to trigger next iteration

Select Set entity property

image-20250331-141526.png

 

Setup property and label field into current issue, see Trigger rule.

 

On the main branch

Select Set entity property

image-20250331-142027.png

 

Clear off the issue property, just leave the field value empty.

Do NOT remove the label easeReq from the issues added to tree to avoid loops over related issues.

Enable the rule

Provide a name for the rule and then enable it by selecting Turn on rule.

 

 

 Related articles