Hello,
I have need to link many sub-tasks as "is dependent on" both within a story and across several stories within a single Epic. Currently I have automation to create all of the stories and sub-tasks when a certain Epic is created. However many of the sub-tasks need to be linked.
I have solved it by once the automation to create the stories and sub-tasks is complete, then doing JQL search by Summary to find each sub-task, creating a variable to hold each sub-task key and linking them. But there are about 40 sub-tasks and the automation seems cumbersome and takes a while to run.
I was wondering if there is a more efficient way to do this? Maybe with {{lookupIssues}}? to find the sub-tasks all at once?
Or would this be better as a Groovy script in Scriptrunner?
Thanks in advance!
Without seeing the specifics of the rule which creates the subtasks...
You might be able to use the Lookup Work Items action or the Story's smart value {{issue.subtasks}} to do this, and it depends upon two things:
Based on the 40 subtasks count, I expect any approach with a single rule will be difficult. Thus, I recommend investigating the external scripting approach.
Kind regards,
Bill
Hi @Bill Sheboy ,
First thank you. I see your name all over these boards and I appreciate you taking time on my question.
We have a set of regular work that requires and Epic, several stories, and many sub-tasks within the stories. The Epic always has specific text in the Summary, i.e., ABCDEF.
I have automation that triggers when an Epic with that text in the summary is created which kicks off an automation to make the 6 stories within that Epic. The stories also always have specific text in their summary as well.
So I have 6 other automations that kick of when a story with specific text in its summary is created which then creates the sub-tasks within those stories.
All of the above works and I have a workaround I mentioned earlier for the linking-using JQL in the automation to find two sub-tasks and link them. There are between 9 and 15 sub-tasks in each story. Currently we use Summary text to find the sub-tasks as they are always the same text, but if there is a different way to do it I would be pleased to hear it.
The whole process above takes 2-2.5 min to complete. Maybe I am just expecting too much but it just seems like there should be a more elegant way to solve this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information, @daniel_jones as it narrows down the scope a bit.
And, based on the question tags I am assuming you are using Jira Data Center. If not, please let me know.
For a single story rule, which adds a lot of subtasks, the issue creation will take a bit of time...and adding the links afterwards will take even more. You can reduce some of the time to find the subtasks to link them in several ways:
For that second option, assuming the rule uses a Re-fetch Issue Data after adding the subtasks, the key for the subtask with a summary containing "CODE REVIEW" could be this:
{{#triggerIssue.subtasks}}{{#if(summary.match("^.*(CODE REVIEW).*").length.gt(0))}}{{key}}{{/}}{{/}}
I recommend testing with some example issues, perhaps only writing to the audit log without linking initially.
Another option for scenarios like this is to investigate marketplace apps which have additional features to support cloning / templated issue scenarios.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy
Yes I am on Data Center, V10.3.9
I use the Create Issue action as I have need to have the sub-task inherit a few fields from the parent story.
For the {{createdIssue.key}}-this seems like it would work for linking a sub-task the previous sub-task most recently created, but not other ones in other stories. Am I correct? or can these be persistent? I thought variables were only in scope for their immediate action?
Marketplace is not an option as no budget for them :(
Thank you again for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @daniel_jones -- Smart values (including created variables) scope depend upon where they exist and where they were created in the rule. Please see this article I wrote on the topic to learn more. For your scenario, as long as any values are created outside of branches, you should be okay.
More specifically, for the singular {{createdIssue}} one, that is for the most recently created issue. There is a plural {{createdIssues}} smart value that is a list of all the created ones, but that assumes you know the creation order...and that is unknown if you are using the Create Subtasks action.
Again, I suggest trying this with some test issues and writing values to the audit log. If you run into challenges, please post images of your complete rule and the audit log as that will help diagnose any symptoms. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Bill Sheboy
we have a test instance where I can try out your suggestions. if you are interested I will post results back here. Otherwise, have a wonderful day and keep helping all us JIRA master wanna bees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.