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 - Need Sub-Task to have the Task as Parent

Hello, 

I'm a newer user of Jira and cannot find a way to automate the following in bold:

1. When an Issue is Created with a Component = "X"

2. Then: Create a New Task

3. And: Create 6 Sub-Tasks

4. Link the Sub-Tasks to New Task NOT the Epic

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @wendt279 

Are your sub-tasks on the trigger issue or on the newly created one?  If it is the newly created one, your rule probably looks more like this, with a branch, right?

  • trigger: issued created with component "X"
  • action: create new task
  • branch: most recently created issue
    • action: add sub-tasks

If so, in the add sub-tasks action, you can select linked issues and link them to the most recently created issue also.

Best regards,
Bill

Hi Bill, thank you for your response! I have set up part of my automation as you describe. The issue that I'm having is that I can add Tasks but am having trouble adding Sub-Tasks to those Tasks. In the beginning they were just adding to themselves to the Epic.

Conditions: 

  • + When Issue Created
  • Components contains any of "X"

Actions: 

  • Then: Create a New Task
  • And: Create a New Task
  • And: Create a New Task 

Branching:

  • For Stories (or other issues in Epic)
    • Summary equals "X"
    • Then: Create a new sub-task
  • For Stories (or other issues in Epic)
    • Summary equals "Y"
    • Then: Create a new sub-task
  • For Stories (or other issues in Epic)
    • Summary equals "Z"
    • Then: Create a new sub-task

 

It worked when I just had one branching, but now creates duplicates as a result of adding the other branches. Any thoughts/suggestions? 

Thank you in advance!

Hi @wendt279 

As soon as you add those extra creates and branches, the rule can no longer do what you note, as the only built-in options for linking are to the trigger issue or the "most recently created issue".

Please consider posting an image of your rule, as that will help confirm this is what is happening.

In that case, you would need to probably use other branching (or try advanced branching) and advanced edit with JSON to add the links to other issues.  Here is the documentation for that second part: https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/#Advancedfieldediting-JSON--Linkingissues

 

Thanks for posting the image of your rule.  As I suspected, with this rule layout you would need to:

  • capture and save the key as you create each of the tasks, storing them in a created variable
  • use the created variables to set the links using the advanced edit JSON information I provided.

But before you try that, would you please describe the problem you are trying to solve?  It would seem this rule is creating a "web" of linkages between sub-tasks and tasks other than their parents.  Perhaps there is another approach that will be clearly if the problem is described.  Thanks!

We perform assessments, and each assessment has the same tasks/sub-tasks. I would like the end user to just create the Epic (Assessment XYZ) and have an automate rule that would create all the necessary tasks/sub-tasks for them. We have an assessment onboarding phase, assessment phase, approval phase and want the sub-tasks to fall under those tasks rather than the overall Epic. 

 

Do you have a better way to do this? Again, newer Jira user over here :) 

Thanks for explaining your use case!  You are on the right track, using the trigger to detect the epic create, as you have done, and then create each task and its sub-tasks, one by one.  That will ensure they are linked as you expect.  There are two ways to do this: one rule or two rules.

One rule: pros are one-rule; and con is more complicated due to created variables and JSON edit

  1. trigger: issue created
  2. condition: issue type is epic... and any other conditions you need
  3. action: create issue (task)
  4. action: create variable to saved the {{created.key}}
  5. branch: on "most recently created issue"
  6.             action: create sub-tasks and link using JSON to the created variable key
  7. ... repeat steps 3-6 for each task you want to add to the epic

Two rules: pro are simpler, and easier to test, and require no JSON edit; and cons are gotta maintain both rules

  • Rule A: steps 1-3, and repeat 3 as needed.
  • Rule B: trigger in issue created for task, check that it has no sub-tasks, and then add the sub-tasks
Like wendt279 likes this

Thank you so very much, the first option worked! For other users that are having this issue - here are some screenshots. 

Like Bill Sheboy likes this
Like Bill Sheboy likes this

I am glad to hear that worked for you!

One more suggestion: you may want to use a different name for the created variable than {{key}} as that is the name of an existing smart value, and there is a risk it could end up resolving to a different issue in the rule.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

114 views 1 12
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