Automation: When issue transitioned link to last created issue from another project

Bodavo June 24, 2021

Hello!

I want to automatically link a transitioned issue from Project A, to the last created issue of project B.

This automation rule works in most cases except when there are found multiple issues via "For JQL". Is it possible to apply the "For JQL" only to the first found issue??

 

Screenshot 2021-06-24 at 16.58.51.png

2 answers

1 accepted

3 votes
Answer accepted
Bodavo June 24, 2021

The solution is simple and thanks to this post the automation rule has to look like this, to get only the first issue:

Screenshot 2021-06-24 at 17.14.25.png

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.
June 24, 2021

Hi @Bodavo 

If you add an ORDER BY statement to your JQL with the Lookup Issues action, that will guarantee that when you use {{lookupIssues.first.key}} it is indeed the latest one.  Without the order by clause, there's no guarantee of the return order of the issues.

Best regards,

Bill

Like Bodavo likes this
Bodavo June 25, 2021

Hi @Bill Sheboy thank you for clarification!

Best regards

0 votes
Ravi Sagar _Sparxsys_
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.
June 24, 2021

Hi @Bodavo 

Within your branch create a variable and assign it the following smart value.

{{lookupIssues.first.key}}

Make sure you create the same variable before the branch with null value, other wise you won't be able to access it later.

{{lookupIssues}} is the list returned when jql is run within your branch rule.

I hope it helps.

Ravi 

Bodavo June 24, 2021

Thank you!

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.
June 24, 2021

Hi @Ravi Sagar _Sparxsys_ 

FYI...I do not believe a created variable will always work in this use case:

  • It will work when a branch returns one-and-only-one issue, as the branch converts to in-line code
  • But when there are multiple issues returned, each issue is processed separately and asynchronously; so the created variables within the branch shadow each other, and then go out of scope, leaving the unset variable prior to the branch.  There isn't even a guarantee that the branched issue processing will complete prior to the next instruction/component after it.

Please see this post for some spirited conversation on the behavior:

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Create-variable-New-component/ba-p/1448118#U1450006


Best regards,

Bill

Like Bodavo likes this

Suggest an answer

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

Atlassian Community Events