Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation to create Epic and set Epic Link of trigger issue to the created epic

Steven Mills February 23, 2023

Hi everyone, 

I'm trying to create automation that does the following:

  1. Manual trigger
  2. Create Epic
  3. Update trigger issue's Epic Link to be the newly created Epic in step 2.

I've managed to do step 1 and 2. So, I have the epic, but I can't seem to set the Epic Link of the trigger issue to the the epic. I've tried creating a variable using the new epic issue's key. The variable is working properly as I can see the correct key in the audit log.

However, when I set the Epic Link on the trigger issue to my variable, the Epic Link is not set. 

Any ideas?

1 answer

1 accepted

0 votes
Answer accepted
John Funk
Community Champion
February 23, 2023

Hi Steven - Welcome to the Atlassian Community!

Can you share the actual rule that you have so far? 

Steven Mills May 16, 2023

Hi @John Funk - Thank you for the support. 

I've shared a screenshot of the rule so far below. 

Basically, when triggered on a issue, the rule will create an epic in the same project and add the initiator as a watcher. Ideally, I'd like the rule to add the trigger issue as a child issue of the epic it just created. 

Is there any way to do this?

Thank you.

Screenshot 2023-05-16 150635.png

John Funk
Community Champion
May 23, 2023

Maybe create a variable to capture the key of the Epic under the Most recently created issue branch. And then use that value to update the Epic Link field of the trigger issue. 

Steven Mills May 23, 2023

Hi @John Funk 

I've tried this before, but it hasn't worked. I've update the rule but it's still not worked. I've reviewed the log, which shows the correct {{issue.key}} of the epic, which I'm storing at {{newEpicKey}} and adding to the log. When I set the trigger issue's Epic Link to {newEpicKey}} there's no Epic on the trigger issue and no child issue on the epic.

Am I doing anything wrong?

Screenshot 2023-05-23 095403.png

John Funk
Community Champion
May 24, 2023

Since the branch fires and does it's thing, the Edit will immediately fire at the same time. So I suspect that the Edit is happening before the branch finishes creating the variable. 

Try adding a couple (or 3!) Re-fetch Issue actions immediately prior to the Edit action for the Epic Link. 

Steven Mills May 24, 2023

Hi @John Funk 

By pure chance, I've actually just figured out the problem. This time I moved the logging of the variable outside of the branch and the log showed nothing. I did a quick search and stumbled upon a JSWCLOUD ticket (JSWCLOUD-22527).

It appears that variables created inside a branch cannot be used outside the branch except in the case where the variable is initially declared outside the branch first. 

So, I've created the variable before branching, copied the same action into the branch, and then used the variable outside the branch. 

Here's the new rule that's working.

Screenshot 2023-05-24 092820.png

John Funk
Community Champion
May 24, 2023

Perfect! Nice job implementing the fix. 

Steven Mills May 24, 2023

Thanks for the support!

Like John Funk likes this
John Funk
Community Champion
May 24, 2023

You are very welcome. 

Suggest an answer

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

Atlassian Community Events