Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,301,312
Community Members
 
Community Events
165
Community Groups

Clone subtasks with Jira automation?

Hi,
Is it possible to clone task and subtasks with Jira automation?
https://support.atlassian.com/jira-software-cloud/docs/move-an-issue-with-automation/

1 answer

1 vote

Hello Hoang,

Welcome to Atlassian Community!

Searching using the details you provided, I was able to find a thread from 2017 with a workaround to use the advanced mode to copy the subtasks when cloning a Task.

Currently, it's not possible to do this automatically because there is no option to select to copy the subtasks.

 We are tracking the ability to clone subtasks automatically at - AUT-335

In the mean time, you can mnaully loop over the sub-tasks of the original issue and clone these. You will need to overwrite the parent in the advanced section with:

{
    "fields": {
        "parent": "{{createdIssues.first.key}}."
    }
}

This will set the parent of the cloned issue to the first issue created in the rule - in this case the original clone.

Please, give it a try and let us know how it goes.

Regards,
Angélica

Hi @Angélica Luz, I ran across the same 2017 post that seemed to be exactly what I was looking for. Unfortunately, then I realized that the resulting cloned subtasks had the reverse rank order as compared to the original list of subtasks. This is especially problematic for our use case as there are over 100 subtasks and the order is critical. Manually re-ranking the list is clearly not an ideal solution. Any thoughts?

Hi, @Angélica Luz - the JSON you included in your Mar 11 2020 reply generated an error for me. The parent property is evidently not a field, it is a root level attribute. I rewrote the JSON as this and it modified the issue's parent:

{
"parent" : "{{createdIssue.key}}"
}

Unfortunately, even though this set the parent value as I hoped it would, the cloned Sub-task still showed up as a child of the original Task instead of a child of the original Task's new clone, as I mention here. If I've uncovered a bug, please reply and I'll create a bug report. Thanks.

Hi @Jeff Cadow he-him 

Context is important for automation rules, and so please post images of your entire rule and the audit log details.  That will show which issue is being used as the source for adding the subtask, and what adjustments are needed to fix the symptom.  Thanks!

Kind regards,
Bill

Like Jeff Cadow he-him likes this

Hi, @Bill Sheboy - Oops - sorry!

I finally got my automation rule to properly link the new Sub-task clones to the new Task clone. It entailed creating a variable to hold the new parent Task.

Screenshot 2022-06-13 160021.png

Like Bill Sheboy likes this

Well done!  You could also do that without the created variable by referencing the value directly as {{createdIssue.key}}

Your version works because created variables are currently text-only, and the default smart value (field) returned for {{createdIssue}} is the key.

In the future, I hypothesize that created variables might preserve the object/type of the source smart value.  For example, text, numeric, list, issue, etc.  If that happens your rule will probably still work due to the default smart value for an "issue", but if it doesn't that may be the problem.

Like Taranjeet Singh likes this

Suggest an answer

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

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

234 views 2 8
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