Related issues automation

JIRA Admin December 21, 2020

Hello,

What is the .json that should I use to add this automation?:

Example:

In Project A: I have Issue 1, Issue 2 and Issue 3.

In Project B: I have Issue 4, Issue 5 and Issue 6.

Manually I related some issues like this:

Issue 1 is related with issue 4. Issue 2 is related with issue 5. and Issue 3 is related with issue 6. (They are related with "RELATED TO")

Now:

I want to create an automation, that when, issue 1 and issue 2 and 3 are related, then in issue 4, Issue 5 and Issue 6 are related with (RELATED TO).

 

I tried this, but it is doesn't work:

 

{"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Relates"
},
"outwardIssue": {
"key": "{{issue.RelatesTo.getKey()}}"


}
}
}
]
}
}

 

1 answer

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2020

Hi @JIRA Admin 

Have you tried a global / multi-project rule, and just use the Link Issue action instead of JSON?

Best regards,

Bill

JIRA Admin December 22, 2020

Yes, I tried but it doesn't work. If I do that, then the linked issue is duplicated in the issue, I would have in issue 4, two times the issue 1. And I want in issue 4, the issue 5 and 6.

I want to reproduce what says the example:

I want to create an automation, that when, issue 1 and issue 2 and 3 are related, then in issue 4, Issue 5 and Issue 6 are related with (RELATED TO).

JIRA Admin December 22, 2020

I think, the only way is with a .json, but I don't know how to say in jql that I want the key of the issue that is related to an issue, 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 22, 2020

Hi @JIRA Admin 

If the global rule does not work for you, I am unclear how you can do this with JQL.  Note that JQL is not a complete SQL (e.g. ISO SQL), so you have limited control of what you can do.

It appears you are attempting to create a redundant web of links between sets of issues across multiple projects, and so it is unclear to me what problem you are trying to solve.

If it helps, there is a syntax for JQL to find the linked issues for a specific type.  That may get you closer to being able to iterate over the result set of issues.

issue IN linkedIssues({{issue.key}}, "related to")
JIRA Admin December 23, 2020

Hi Bill, thank you, I know how to find linked issues. But what I don't know, is to find this issues by .json.....

 

What would be the .json? I tried with this, but it doesn't work because it is not good-written:

 

{"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Relates"
},
"outwardIssue": {
"key": (issue IN linkedIssues({{issue.key}}, "related to")

}
}
}
]
}
}

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 23, 2020

Thanks for that information, @JIRA Admin 

In your JSON, you are trying to update multiple items when that JSON only works for one item at a time.  What you could do instead is use the JQL in an automation branch, and then update each issue, one at a time.  Please see this documentation for more information:

https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events