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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,440
Community Members
 
Community Events
184
Community Groups

Global variable in automation

Hi all,

I'd like to create automation that updates an Epic's custom field based on a comparison of its child issues data.

Basically I'd like to achieve the following:

- When: An Epic is closed

- Then: It loops through the Epic's child issues and finds the latest resolution date 

- And: Updates a custom field (e.g. 'End date') on the Epic with the latest resolution date of the previous step

The problem I'm facing is that variables created in automation routines in Jira don't have global scope, so a variable that is set within an if branch is not visible outside of it.

Does anyone have any ideas about how I could solve this problem?

Thank you in advance,
Tony

2 answers

1 accepted

1 vote
Answer accepted
Fernando Eugênio da Silva
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.
Apr 24, 2023

@Tony Georgiadis 

 

You don't necessarily need to use BRANCH if your trigger is a recognized Epic event.

See an alternative you can achieve to do this. Assume that I am using the Due date field as a reference, but in the end, you just change it to the field that makes sense to you

  • Trigger: Issue transitioned
    • To status -> Done
  • Condition:
    • Issuetype Equals Epic
  • Action:
    • create a variable
    • Smartvalue: {{issue.key}}
    • Name: epic
  • Action:
  • LookupIssue with the query:
    • "Epic Link" = {{epic}} ORDER BY duedate DESC

I'm using the Due Date field for the example, but you just need to change the field after ORDER BY for your date field. Use DESC to sort for the major to minor Date

  • Action: Edit Issue
    • Select your field and add the smartvalue: {{lookupIssues.first.duedate}}

In this case, you don't need the BRANCH because, as the Epic is the issue trigger for the Event, you only need to use the lookup feature to search for issues within the Epic itself.

If this doesn't work for you, share your rule details via images so we can help you achieve your goal.

Regards,

Fernando

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 24, 2023

Good suggestion, @Fernando Eugênio da Silva 

You don't actually need to create a variable for the issue key of the Epic. Just use {{issue.key}} in the Lookup Issues JQL where you have {{epic}}.

Also note that if this is for a Team Managed project, in the JQL of the Lookup Issues action you need to use Parent rather than Epic Link.

I would also recommend adding a condition after the check that the trigger issue was an Epic to ensure that the Epic has child issues.

Screen Shot 2023-04-24 at 3.31.33 PM.png

Or add a condition after the Lookup to ensure that the Lookup found issues:

Screen Shot 2023-04-24 at 3.32.57 PM.png

That worked and it's clean. Thank you both, I appreciate the help! :)

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