Create issue link when issue is created

Use case

Save time and link the created issue to its appropriate issue links automatically. For this rule, when creating a Task in a project with the key "CS", this task will get linked issues from all sub-tasks within the same project and with the summary "Maintenance".


⚒️ Configuration

Issue event

Create a new rule and name it appropriately.

Providing a description will help you to identify what the rule does but this step is optional.

Add a trigger → Issue event → Issue Created

No further configuration is needed. The automation rule is triggered every time an issue is being transitioned.

Boolean condition

Add a ConditionBoolean Condition 

Expression

Use the following Parser Expression:

Bash
%{trigger.issue.project.key} = "CS" and %{trigger.issue.issueType} = "Task"

Next to the Boolean Condition click on Add → Action → Create issue link

Issue link type

Choose relates to (Relates)

Issue selection

Choose Issue List Expression

Use the following Parser Expression:

issuesFromJQL("issuetype = 'Sub-task' AND summary ~ 'Maintenance' AND project = '" + %{trigger.issue.project.name}+"'")

The issuesFromJQL() expression parser returns the issue list of issues returned by the specified JQL query. Visibility restrictions (permissions and issue security) might apply. By default, this query will be run as the current user.


Enable the rule by clicking on the Enable button  rule-status-off.png →  rule-status-on.png

📤 Import the example

Import the JSON file below to get started in no time

JSON

After importing the JSON file, make sure to check the configuration of the rule. Non-existing configuration elements (issue types, fields, values etc.) will be highlighted.

JavaScript
{
"name": "Create issue link when issue is created",
"description": "",
"creator": "admin",
"status": true,
"triggerData": "1",
"triggerType": "ISSUE_EVENT",
"configuration": {
"refs": [
"issue",
"system",
"trigger.issue",
"trigger.parent"
],
"triggerType": "1"
},
"children": [
{
"sequence": 0,
"type": "BOOLEAN_CONDITION",
"ruleEntityType": "CONDITION",
"configuration": {
"refs": [
"issue",
"project",
"system",
"trigger",
"trigger.issue",
"trigger.parent"
],
"expression": "%{trigger.issue.project.key} = \"CS\" and %{trigger.issue.issueType} = \"Task\"",
"expressionParsingMode": "logical",
"actingUser": "field_00020"
},
"children": [
{
"sequence": 0,
"type": "LINK_ISSUE",
"ruleEntityType": "ACTION",
"configuration": {
"refs": [
"issue",
"project",
"system",
"trigger",
"trigger.issue",
"trigger.parent"
],
"issueLinkType": "inwards_10000",
"destinationIssueSelection": "issues",
"destinationIssueSelectionIssues": "issuesFromJQL(\"issuetype = 'Sub-task' AND summary ~ 'Maintenance' AND project = '\" + %{trigger.issue.project.name}+\"'\")",
"destinationIssueSelectionIssueKeyParsingMode": "textBasic",
"actingUser": "field_00020"
},
"children": null,
"hasChildren": false
}
],
"hasChildren": true
}
],
"hasChildren": true
}


📚 Related use cases