Forums

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

Automation For Jira - Creating automatic subtasks under stories - wrong display

Albert Manuel
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 12, 2021

Hi there,

I have an automation rule where I need to create about 60 tickets when an EPIC is creating - i know is much but it's a process for us, we need to follow.

 

Our process is like that:

When an EPIC is created -> create 5 tasks-> then create 2 stories and about 20 subtasks under those stories.

I have two problems:

1) I don't want the subtasks to be displayed in the EPIC, just the "Issue in Epic". The sub-tasks should be just under story's. I want when i go into a story to see the subtasks there - every story has like 20 subtasks.

atlassian.PNG

 

Is this even possible? Because manually i can do it. I want them to be displayed like this:

So subtasks to be displayed under story only.

 

atlassian -2.PNG

 

2) How can i link the subtasks to the Epic - i want to have the epic link in subtasks also.

Thanks.

 

3 answers

0 votes
Werner Kaeser
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 27, 2022

Create sub-task under a new automated story triggered by a new story.PNG

Sorry for the german wording, but you should be able to guess it.
The trigger is pulled when a new epic gets created manually. Then a new story gets created automatically. After the branch (for stories or other issues in the Epic), the sub-task gets created und der story and und within the epic.

Best
Werner Kaeser

0 votes
Marianne Lee (Nagarro)
Contributor
October 19, 2021

Hi @Albert Manuel , Based on the suggestion from @Bill Sheboy , here's what works for me.  Learnt that branching on all created issues doesn't trigger another separate automation execution.

 

Trigger: Issue created

Condition check: If issue type = Epic

Action: Create new Story (set Epic Link - Copy from trigger issue)

Action: Create new Story (set Epic Link - Copy from trigger issue)

Branch: For all created issues

             Action: Create new Sub-task

             Action: Create new Sub-task

Action: Create new Task (set Epic Link - Copy from trigger issue)

Action: Create new Task (set Epic Link - Copy from trigger issue)


automation.createissues-steps.png

0 votes
Nic Brough -Adaptavist-
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 12, 2021

Ok, the  important thing here, which I think you already know, but haven't mentioned, is that sub-tasks and issues-in-epics are two totally different things.

A sub-task is part of its parent issue, completely, whereas an issue in an epic is an issue that is being grouped (usually with other issues) and flagged as being part of the epic.  The epic-link, which showing there is a relationship, is not saying that the issue is a part of the epic, just that there is a link.

So, that stated, your questions

1) In your screenshot of the Epic, you're showing sub-tasks as being part of the epic and you don't want that.  That's fine, but the simple answer is "don't create sub-tasks for the epic itself".  Jira doesn't care what the issue type of a parent is, and happily lets you create sub-tasks under issue level issues and Epics too.

To fix your issues, go into each subtask and change the parent from the Epic to the story that they should be a part of (when people have done this in the past, I've often seen them just create a new story and bulk-edit all the sub-tasks over to the new story)

2) Sub-tasks do not have an epic-link.  They are linked to an Epic only logically, by being part of an issue that has an epic-link.

This is a bit of a pain in Jira, because it's confusing for reporting purposes - I often find myself creating a custom-field called something like "Epic-all", which copies the Epic link in a story, and looks to a sub-task's parent for the Epic link there.  I think this should really be built-in, but hey, we're not there yet.

Albert Manuel
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 12, 2021

Hi @Nic Brough -Adaptavist- 

Thanks for your answer.

Call me crazy but looking at look at my settings i don;t see a way to change the subtasks to go under stories as you said, check my screenshot:nicscreen.png

Nic Brough -Adaptavist-
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 12, 2021

This automation rule has the wrong triggers on it - it's creating issues when the Epic is created, which is fine for stories, but the sub-tasks it tries to create are going to be under the current issue (the Epic) or the issue triggering the rule (also the epic).  

You'll need to nest the sub-task creations under the stories you want them on, not on the Epic create.

The change I was talking about was for fixing your already created sub-tasks though, I wasn't looking at the automation.

Albert Manuel
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 12, 2021

Damn, i need to figure a way of creating these subtasks under the story's - probably i will need a second automation rule to be triggered somehow and create them.

Nic Brough -Adaptavist-
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 12, 2021

Yes, sorry, I've not tried this myself with Automation, I don't know if you can nest them into the same automation or if you'd need to do them separately (so that your Epic automation creates stories, and the creation of the stories triggers an automation to do their sub-tasks)

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 12, 2021

Hi @Albert Manuel 

After you create the tasks in the rule, you may then access them using the {{createdIssue}} or {{createdIssues}} smart values.  With those, you can branch on them and create the subtasks under them.

https://confluence.atlassian.com/automation/smart-values-993924860.html

Kind regards,
Bill

Albert Manuel
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 12, 2021

Hi @Bill Sheboy 

If im not asking too much, based on the screenshot above, can you give me an example?

 

Thanks

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 12, 2021

Let's say you add a task and then want to add associated subtasks.  To do that you would:

  • action: create task
  • branch: on most recently created issue
    • action: add subtasks
  • ...continue your rule

If you wanted to add the same subtasks after creating multiple tasts/stories within the rule, just change the branch to use on "all created issues".  For example:

  • action: create task
  • action: create another task
  • action: create another task
  • branch: on all created issues
    • action: add subtasks
  • ...continue your rule
Like Marianne Lee (Nagarro) likes this
Davis Moes November 11, 2021

Hi @Bill Sheboy 

Let's say your automation rule creates an epic and you want to create multiple stories under the newly created epic, with each story creating their own unique sub-task. What would the rule structure look like then?

Thanks!

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 11, 2021

Hi @Davis Moes 

Is this for a company-managed project (CMP) or a team-managed project (TMP)?  This is possible for CMP but not TMP.  (Those cannot dynamically link to parent field in a rule yet.)

If CMP, you could do this two ways: one-by-one or in a loop.

One-by-one

  • trigger: whatever you are using
  • action: create the epic
  • action: use a created variable to save the epic's key with {{createdIssue.key}}
  • action: create a story, linking with Epic Link to the variable
  • branch: on most recently created issue
    • action: add the sub-task
  • action: create a story, linking with Epic Link to the variable
  • branch: on most recently created issue
    • action: add the sub-task
  • ...repeat those 3 steps for the other stories

 

In a loop

  • trigger: whatever you are using
  • action: create the epic
  • action: use a created variable to save the epic's key with {{createdIssue.key}}
  • action: create a story, linking with Epic Link to the variable
  • action: create a story, linking with Epic Link to the variable
  • ...repeat for all stories
  • branch: on all created issues
    • condition: issue type is story 
    • action: add the sub-task

 

Kind regards,
Bill

Davis Moes November 11, 2021

I'll give that a shot - thanks @Bill Sheboy !

Like Bill Sheboy likes this
King Yiu Chu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 21, 2022

 

@Bill Sheboy How do you create a branch on "most recently created issues"?

I'm trying to use smart values to create an EPIC with multiple unique stories and every story has it's own unique subtasks but I have no clue where to put in what with smartvalues. 

Can you show me an example?

 

In other words your comment as shown here below doesn't give me a direction how to do this?

  • action: use a created variable to save the epic's key with {{createdIssue.key}}

Would love to hear the answer. Thanks!

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.
March 21, 2022

Hi @King Yiu Chu -- Welcome to the Atlassian Community!

I recommend creating a new question for your use case; including images of your current rule and audit log; and perhaps linking to this thread.  That will get the most people looking at it to help.  Thanks!

For what you have asked thus far...

In branches there is an option to select either the most recently created issue or all of the created issues, up to the current point in the rule before the branch.

And regarding what I noted about the created variable: the purpose of that was to both create and epic and the children in the same rule.  So the created variable was to save the epic's information first, create a child issue, and then branch on that child issue to add the subtasks.  If you need more information from the epic:

  • child issues can get that information directly once assigned to an epic, and then re-fetched
  • the sub-tasks creates cannot do that, so you would need to either use Lookup Issues or Create Variable to save what you need from the epic first.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer