CLOUD | DATA CENTER AND SERVER
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 |
---|---|---|
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
| 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
| Store the entered value of the target project key into the issues property: |
| Select Edit issue
| Use any field to trigger the execution of the rekursive rule. E.g. Fill up the Labels field with easeReq
|
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 |
---|---|---|
Create a new rule | Select the Create rule button. Set flag |
|
Create a trigger for the rule | Select the trigger Field value changed in section Issue Triggers.
| 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
| Verify if the label includes the expected value. |
Verify condition | Select: IF: {{smart values}} condition | 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
| Copy the property easeReq into a smartvalue for easier handling.
|
Store current issue key | Select Create variable
| Store the current issue key for the below web request.
|
Start iterating over the linked issues | Select FOR EACH: Add a branch
| Select the Branch rule / related issues option for linked issues, select the desired issue link types, e.g. trace to
|
Add REST API web request | Select the action Send web request
| Web request URL: Use
HTTP method: Web request body: 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:
Headers: Add the following two key/value pairs:
Example of headers: |
Set values to trigger next iteration | Select Set entity property
| Setup property and label field into current issue, see Trigger rule.
|
On the main branch | Select Set entity property
| 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. |
|