Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

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

Hi @Bill Sheboy thank you for clarification!

Best regards

0 votes
Ravi Sagar Community Leader Jun 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 

Thank you!

Hi @Ravi Sagar 

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
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

875 views 2 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you