Automation - Need Sub-Task to have the Task as Parent

wendt279 July 19, 2021

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
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.
July 19, 2021

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

wendt279 July 19, 2021

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!

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.
July 19, 2021

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

 

wendt279 July 19, 2021

Screen Shot 2021-07-19 at 2.47.41 PM.pngScreen Shot 2021-07-19 at 2.47.56 PM.png

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.
July 19, 2021

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!

wendt279 July 20, 2021

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 :) 

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

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
wendt279 July 20, 2021

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
wendt279 July 20, 2021

Screen Shot 2021-07-20 at 3.24.41 PM.pngScreen Shot 2021-07-20 at 3.25.03 PM.pngScreen Shot 2021-07-20 at 3.25.11 PM.pngScreen Shot 2021-07-20 at 3.25.16 PM.pngScreen Shot 2021-07-20 at 3.25.24 PM.png

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

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
AUG Leaders

Atlassian Community Events