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

How can I create multiple epics each with their own tasks associated in one rule?

Julia October 20, 2021

I want to create an automation that does the following

1. Create Epic 1 with parent link as Initiative 1

  • Task with Epic 1 as parent 

2. Create Epic 2 with parent link as Initiative 1

  • Task with Epic 2 as parent 

3. Create Epic 3 with parent link as Initiative 1

  • Task with Epic 3 as parent  

I already know how to make the Epics & correctly link them to the initiative by using: 

{
"fields": {
"Parent Link": "{{triggerissue.key}}"
}
}

 

How can I make the Tasks have their Epic Links be as defined above? 

2 answers

1 accepted

1 vote
Answer accepted
Julia November 19, 2021

I ended up creating three rules. One to create the 2 epics and the following two to make tasks for each of those epics.

0 votes
Mykenna Cepek
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.
October 20, 2021

Just create the first Epic, and save that issue off in a variable from the {{createdIssue}} smart value:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/#Smartvaluesgeneral---createdIssue--

Then create the first Task under that Epic, and use the saved variable to set the "Epic Link" field. This can be done in the GUI, no JSON needed.

Rinse and repeat!

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.
October 20, 2021

Hi @Mykenna Cepek and @Julia 

I think that when you add the task, you can just set the "Epic Link" to {{createdIssue.key}} without the created variable, as that will contain the last created one in the rule...as long as it wasn't inside of a branch.

Kind regards,
Bill

Julia October 20, 2021

@Mykenna Cepek When you say "save that issue off in a variable" how can I do that? I know how to call {{createdissue}} but how do I do that for each epic and save them uniquely? 

 

@[deleted] would that solution confuse the automation since the last created issue for some of the tasks would be a preceding task? 

for example:

Epic 1: 

  • Task 1 with epic link as {{createdIssue.key}} would work fine
  • Task 2 with epic link as {{CreatedIssue.key}} would the automation try to use Task 1 since it was created the most recently ?
Mykenna Cepek
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.
October 20, 2021

@Julia You're concern about the last created issue being replaced by the most recently created Task is valid. This is why I suggested saving it in a variable.

To create a variable, just use the "Create Variable" action:

https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Createvariable

Basically you just make up a variable name (like "LatestEpic") and fill in {{createdIssue}} for the Smart Value. That variable will hold the value you set.

Then use {{LatestEpic}} when setting the "Epic Link" field for each new Task.

Once you've processed the first Epic and all it's Tasks, then create the second Epic, and use that same "Create Variable" action again (with identical parameters). This will update the variable to relate to the second Epic.

And so on!

Julia October 20, 2021

Oh no! That would work perfectly, but I'm on Jira Server and that option isn't available. Thank you for the suggestion, I wish I could use it. 

@Mykenna Cepek 

Mykenna Cepek
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.
October 20, 2021

Hmm. Ok, plan B...

There is a smart value called {{createdIssues}} -- plural. Apparently it aggregates a list of all the issues created in this rule. So...

Create all the Epics first. At this point, I would expect the {{createdIssues}} smart value to be a list of all those Epics.

Then create each Task, and use a smart value list function to pull out the appropriate Epic from {{createdIssues}} when setting the "Epic Link" field in each Task.

According to the Jira Server docs for Automation and smart value list operations...

https://confluence.atlassian.com/automation/lists-993924868.html

...something like {{createdIssues.get(0)}} should return the Epic Link value for your first set of Tasks. Increment the number for each successive Epic.

Like Bill Sheboy likes this
Julia October 21, 2021

 

Thank you! Let me try this and let you know if it works.

Like Bill Sheboy likes this
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.
October 21, 2021

Hi, and sorry I am catching up on the thread.  :^)

My understanding of {{createdIssue}} singular is that it *always* contains the information from the most recently created issue in the rule...With one exception: there is a by-design behavior that this can get "lost" when issues are created in a branch.  (Branches of more than one thing fire off independently of the rule, and so there is no guarantee when they finish.)

So, I was proposing a variation of what @Mykenna Cepek noted using {{createdIssues}} plural.  One at a time would be:

  • created an epic
  • create a task linked to the most recent epic using {{createdIssue.key}}
  • created an epic
  • create a task linked to the most recent epic using {{createdIssue.key}}
  • ...
Mykenna Cepek
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.
October 21, 2021

Totally makes sense, @Bill Sheboy. I had two (unconfirmed) concerns with this approach:

  • I assumed a need to (at least sometimes) create multiple Tasks under each Epic. Upon review, that wasn't explicitly stated in the OP. Might end up being a "subtle brittleness" that would misbehave if a second Task was added.
  • I wasn't confident about the value of {{createdIssue}} during a "Create Issue" action, and didn't have time to verify that it would be the previously (not currently) created issue.

I think we're both interested in hearing what eventually worked for @Julia ! 

Like # people like this
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.
November 19, 2021

Hi @Julia 

Just following up to learn if you resolved this one.  If so, would you please mark it as answered?  That will help others in the future find solutions faster.  

Thanks,
Bill

Julia November 19, 2021

n/a

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events