Can I create sub-tasks when a specific transition occurs using Automation for JIRA Cloud?

Sam Hall Community Champion Nov 30, 2016

I want to create a set of sub-tasks when a particular transition occurs.

For example, when an issue moves from To Do status to In Progress status, I want to automatically create a couple of sub-tasks.

I only want this to happen once, though - just the first time the issue is transitioned.

I think this is possible with Automation for JIRA (Cloud version), but what is the best way to implement?

Thanks

3 answers

1 accepted

Accepted Answer
1 vote
Andreas Knecht Community Champion Dec 01, 2016

Hi Sam,

I'm one of the creators of Automation for JIRA and you can certainly do this.  Here's what the rule needs to look like:

conditionally-create-subtasks.png

Lets break this down:

  • Whenever an issue is transitioned
  • We use a compare two values condition to check if the status has changed from a particular old value to a new value using this smart-value: 

    {{#changelog.status}}{{fromString}} > {{toString}}{{/changelog.status}}
  • Next we use the "Related issues" condition to check if any sub-tasks are present yet (you could also use JQL here to check for specific sub-tasks)
  • Finally we create 2 new sub-tasks with the "Create sub-tasks" action.

Detecting the status change is a bit complicated still, but we'll ship a new trigger in the next couple of days, that will make this even easier!  It will allow you to run a rule whenever any issue field value changes (including status).

 

Andreas Knecht Community Champion Dec 03, 2016

Just to let you know - the new trigger I talked about in my answer above is now available in production as well. You can see an example here: https://blog.codebarrel.io/automatically-update-issues-when-a-jira-issue-field-value-changes-d932f3ea6f0f

Makes it a bit easier to trigger a rule when the status changes!

Hi Sam,

Disclaimer I work on ScriptRunner for JIRA Cloud.

This is exactly the kind of use case ScriptRunner for JIRA Cloud is designed for. You could use a Create Subtask Post Function (http://scriptrunner-docs.connect.adaptavist.com/jiracloud/post-functions.html#_create_subtask) with a condition on the number of subtasks the issue has.

Regards, Jon

Sam Hall Community Champion Dec 01, 2016

Thanks Jon. I'll give it a try and see how it works.

Sam, There is an add on for multi sub task creation in market place. Once installed, you can see that as part of your post function for your transitions while editing your workflow. Edit the transition for 'To Do', click on Post Functions tab, use the multi sub task utility to define your sub task attributes, publish the updated workflow. Now when you move the issue from To Do status to In Progress, your sub tasks will be automatically be created. You can see them in your issue detail screen. Good luck.

Sam Hall Community Champion Dec 01, 2016

Thanks Guhan. What's the add on called?

Sam, I used JIRA Suite Utilities (JSU) long time back. I could see that it is not supported by Atlassian anymore, but the functionalities are there in Bobs Issues on Transition related add on too. Market place may have the latest ones and hope you can find one suitable for your environment.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

21,939 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you