Forums

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

Automation: Subtask clone action results in reverse order creation and therefore reverse rank

Rick Crow
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.
June 1, 2020 edited

I have an automation that is manually triggered which clones a task and its subtasks. The cloning needs to happen each quarter and there are over 100 subtasks ranked intentionally. When the automation runs, the resulting list of subtasks is in reverse rank order due to the fact that the subtasks were evidently cloned starting with the highest issuekey to the lowest ... in our use case then, from the lowest-ranked issue to the top-ranked issue. This is problematic due to the subsequent need to manually re-rank the subtasks every quarter.

Any thoughts on how to overcome this behavior?

 

Screen Shot 2020-06-01 at 11.41.31 AM.png

3 answers

1 accepted

1 vote
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.
June 5, 2020

Hi @Rick Crow 

Let's backup a bit and confirm what problem you are trying to solve. That will help the community suggest ideas.

  • You can manually clone a task with subtasks, preserving the subtask order
  • You cannot use automation rules to clone a task with subtasks and preserve the order. The reason appears to be that cloning in this path does not copy the issueLinks table, which is where the subtask order is stored.

What do you need to do with the automation rule that cannot be done by manually cloning?

Thanks!

Rick Crow
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.
June 5, 2020 edited

Bill, great point! I guess I haven't used that feature for so long, it just didn't come to mind as an option.

The only problem I'm seeing with that is that the resulting subtask names are all prefixed by "Clone - " and there's no option to affect this manually. I'm hoping there's a way to strip those prefixes as part of another automation ... I'll start looking now.

-----

Update ... figured out that last part!:

{{issue.summary.substringAfterLast("- ")}}

 

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.
June 5, 2020

Thanks! So try this:

  • Clone manually
  • Create a manually triggered rule...
  • Iterate over the issue and subtasks...
  • Updating to remove, using substringAfter() to strip off the Clone info

You can read about that function here:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/

Like John Funk likes this
Rick Crow
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.
June 5, 2020

Exactly!

Thanks.

Like Bill Sheboy likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 6, 2020

Brilliant!

1 vote
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.
June 3, 2020

Hi @Rick Crow 

I haven't tried this, but I wonder if instead of using the clone action, you use JQL to return the subtasks in rank order, and then iterate over them individually.

Best regards,

Bill

0 votes
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 4, 2020

Hi Rick,

I'd have a crack at what Bill has suggested, it sounds like a sound approach!

Cheers,

Simeon.

Rick Crow
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.
June 4, 2020

I’m not sure what that looks like after the JQL to find and order the subtasks if not using the clone issue action, however. 

Also, the behavior I’m seeing, IMHO, should be altered so that the original subtask order/rank is preserved given the expectation of a clone action ... as is, it’s more of a ‘mirror’ action. 😎

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 5, 2020

Haven't tried this either, but maybe the JQL would look like:

issuetype = Sub-task ORDER by key

Try that out in the advanced filter section first to see results

Rick Crow
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.
June 5, 2020 edited

Without the clone action, what action would I use to create the subtask copies? Also, I assume 'use JQL' means I should use the 'For JQL' branch rule rather than the 'For Subtasks' branch rule? I've tried it that way, as well as by keeping the same 'For Subtasks' branch rule followed by a JQL condition.

So far, my attempts at the suggested approach (and any variations) have resulted in a disconnect between the new subtasks and the new parent task ... even though I'm using this code in the 'more options' area, which worked with my original approach (without the JQL).

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

On the positive side, the error message in the log for this rule does seem to list the failed subtask creation steps in the correct order as opposed to what I've seen earlier where they were listed in a reverse-ish, random order.

CC: @Simmo 

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.
June 5, 2020 edited

Greetings, all!

Replacing my earlier response...

It does not appear there is a way to query and order subtasks for a parent. The information is in the issueLinks table, but that value's sequence attribute is not sortable.

Sorry for the detour, community!

Best regards,

Bill

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 5, 2020

Was just thinking the that key represents the order they were created. 

I have to confess, I don't under the whole ranking business and how that is done by the system. Keys I know!  :-)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events