Forums

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

Automate adding substring of the parent task summary name to the subtasks

Tina.Henry January 25, 2022

Is there a way to automate adding part of the parent task summary name to subtasks when created - or if cloned?  I have a number of subtasks that need to be created for each issues.  For our project the subtasks are the same for each issue so I'd like a way to differentiate by parent task.  Currently I'm experimenting with cloning an issue that has been set up to be a "template".  I'd like to remove the label "CLONE" from the subtasks when created and replace it with a substring of the first 10 characters of the parent summary name. 

Alternately I'm considering setting up an automation to create subtasks when the issue moves into certain workflow lanes.  In this case I'd like to append the substring of the parent issue summary name to the beginning of the subtask summary name when created.

1 answer

1 accepted

0 votes
Answer accepted
Mark Segall
Community Champion
January 25, 2022

Hi @Tina.Henry 

For the first part of your question... Yes, you would create an automation rule that would be triggered by issue create and action would be to update the field with a smart value

{{issue.summary.left(10)}}

 

As for the second part of your question, I repeatedly use automation rules for spawning other issues and that smart value above would be used in the summary of the create issue action.  Then add all of the other fields you want populated and set to copy from current issue or copy from trigger issue.

Tina.Henry January 25, 2022

Thanks Mark.  I gave the suggested smart value a try. The result was that the substring was applied to each subtask summary name.  I'd like to append the 10 character substring of the Parent issue summary to the subtask issue summary.   Is there a way to pull this from the parent and add it to the subtask?

Mark Segall
Community Champion
January 25, 2022

Hi @Tina.Henry - Can you share a screenshot of what you've got so far. I'm thinking you need a branch rule, but a screenshot would be helpful to make sure I'm understanding the issue correctly.

Like Bill Sheboy likes this
Tina.Henry January 27, 2022

Hi @Mark Segall .  Here's a screenshot of the "template" Issue I created.  And you can also see the list issues in the current sprint.  The project's focus is the creation and enhancement of  Validation checks. So each task will have similar requirements and the same subtasks.  So I'd like to create the tasks by starting with this "template".  I've successfully built the automation remove "CLONE" from the subtasks.  Now I want to append the first 9 or 10 characters from the Parent task name to each of the subtasks so that when notifications go out for the subtasks and on dashboards, there's a clear indication as to which issue it refers.  The second screenshot shows the desired result (which I'd created manually).  Actually now that I think about it what would work best is to append the characters before the first space as the length of the VC# varies. Is there a formula I could employ for that result?

I didn't capture a screenshot of my initial attempt at this automation, but if I remember correctly what I got was a subtask named "Outline R Outline Requirements and Wiki Content" instead of my intended result: "VC304-14 Outline Requirements and Wiki Content"

Does this help?

jira template clone Q.JPG  jira template clone Q2.JPG

Mark Segall
Community Champion
January 27, 2022

@Tina.Henry - Thanks for sharing, I think I understand now.

So yes this is totally possible.  So to be clear, you're not necessarily looking for 10 characters as much as appending the original issue key to the summary (at least that's the direction I would take because at some point that could become 11 or 12 characters.  Here's a quick sample rule:

2022-01-27_08-00-30.png

...and for easier copy/pasting, here's what I put in the summary:

{{issue.parent}} {{summary}}
Tina.Henry January 27, 2022

@Mark Segall Ok, I gave that one a try.  Getting warmer. But my automation to remove clone seems to have broken.  I tried adding this as a separate automation and then adding it as another step in my automation to remove clone from the title.  Both scenarios resulted in "CLONE" remaining in the title.  Is there a nuance that I'm missing? Do both need to be in the same automation step?

jira template clone Q3.JPG

Mark Segall
Community Champion
January 27, 2022

Ahh ok.  Yes, tweak it like this:

{{issue.parent}} {{issue.summary.remove("CLONE - ")}}
Tina.Henry January 27, 2022

@Mark Segall  Success!  Thanks so much!

Like Mark Segall likes this
Tina.Henry January 27, 2022

@Mark Segall  Can I ask you one more question?  I'm having trouble with the subtasks from my cloned issue coming out in the wrong order.  - a different order than  what's in the task I've cloned.  If I can't fix that I'm thinking I may need to abandon my clone plan and automate the creation of subtasks when the issue is created.  So I'm taking that for a spin and attempting to preface the subtask name with {{issue.parent}} , but that is not being incorporated when the subtask is created.  Should I be able to use this same syntax in this scenario as well?

Mark Segall
Community Champion
January 27, 2022

Not sure I follow regarding the order of the subtasks.  They will appear in ascending order by their issue key on the issue detail view.

If you have an automation to generate the subtasks, you can definitely prepend the parent issue id, but since you're creating the summary from scratch, you'd need to apply some logic... For example, let's say you wanted to generate a Story Review subtask when the parent story issues a status of Requirements.  Your automation would look something like this:

  1. TRIGGER: Field Value Changed (Status)
  2. CONDITION: Status = Requirements
  3. ACTION: Create Issue
    1. Summary = {{issue}} Story Review

This is assuming your need for subtasks are tied to some kind of action that has occurred on your parent story.

Tina.Henry January 27, 2022

@Mark Segall  Here's an example of the problem I'm having with the order of subtasks in the cloned issue:  My "template" that I clone for creating new issues has the subtasks created in the order in which they need to be performed.  But when I clone that issue, the subtasks in new issue are not created in the same order. This seems to be a bug as I've found questions where others have encounter this but no found no solution. 

The subtask sort order options seem to be limited as well, and I've also had trouble if with the order changing back key if I drag and drop them back to the correct order

Jira clone order1.JPGJira clone order2.JPG

Tina.Henry January 27, 2022

@Mark Segall Here's the automation I had set up for creating the first subtask when the issue is created.   I've inserted  {{issue.parent}} as the first part of the Summary followed by the subtask name.  When I create and issue everything works as planned except the parent key does not show up in the name.

Jira clone order3.JPG

Mark Segall
Community Champion
January 27, 2022

Solving what I believe is the quick one first... Since you're creating an issue, parent is not going to apply.  You're passing the current issue key to the newly created subtask so you would simply use this for the example provided:

{{issue}} Outline Requirements and Wiki Content
Like # people like this
Mark Segall
Community Champion
January 27, 2022

As for the order, I understand now that you have a template issue with subtasks that you're cloning.  The only advice I have for ensuring subtasks are created in the desired order is to leverage automation to generate issues and corresponding subtasks.  You would basically have a rule with 8 create issue actions.  1 for your parent and then 7 to create the subtasks. The automation rule always steps through in order so you'd be assured that they're being created in the order you want.

Tina.Henry January 27, 2022

@Mark Segall Thanks again for all your help!  I'll explore the option of using the automation instead of the clone - though I though the clone was pretty slick :).  

Mark Segall
Community Champion
January 27, 2022

Yes, in a perfect world your template strategy would work fine and hopefully a fix is in place sooner than later to ensure cloning maintains the order of the source issue/subtask tree.  Until then, automation will address that.

Like Tina.Henry likes this
Aashish Calla
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!
January 11, 2024

Hi Mark,

You mentioned that "If you have an automation to generate the subtasks, you can definitely prepend the parent issue id,".

My question is - I have an automation to create 4 sub-tasks as soon as an issue (parent) is created. Now, I want the auto-created summary of the sub-tasks to have the parent's summary appended to it.

Example - A sub-task named "Testing" gets auto-created when I create a ticket with summary, let's say "New requirement for login page". Now, I want my auto-created sub-task to have the summary: "New requirement for login page: Testing", instead of just "Testing".

Please guide :-)

Mark Segall
Community Champion
January 11, 2024

Hi @Aashish Calla and welcome to the community.  In your automation step that creates the sub-task, you would set the summary to this:

{{issue.summary}}: Testing

If you need further help with this, please create a new question (you can @mention me to get my attention).  This helps enable others searching for your specific question a dedicated thread to find the answer and reduces notifications for those who were following this thread originally but no longer wish to be notified.

Aashish Calla
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!
January 12, 2024

Hi @Mark Segall ,

"Testing" was just an example. Actually, let me explain it more - I've an automation already set, in which as soon as a ticket of the type "Story" gets created, it auto creates 4 sub-tasks (Technical Tasks) in it, namely Testing, Analysis, Code Review, Unit Testing.

Now, what I want is that as soon as I create a new ticket of the type "Story", and hence, 4 technical tasks get created inside it, their names must have the main ticket's summary appended, just as they're created.

Like, for instance, if main ticket's summary is "New login requirement", my 4 sub-tasks auto-created should automatically become, upon creation:

 

Testing: New Login requirement

Analysis: New Login requirement

Code Review: New Login requirement

Unit Testing: New Login requirement

 

Please explain the steps now.

Thanks in advance :-)

Suggest an answer

Log in or Sign up to answer