Create 3 auto sub-task when the parent status changes

All,

I'm created a workflow and cannot proceed forward.

I would like to the following  :

  1. Task in status:'Intake' move in status:'Approve' then in the same time 3 sub-task should be created with a specific name and all 3 of them should have 'Approve' status.

      2. When all sub-task are in status 'Approved' I would like that the task status to change into 'Review'.

 

Hope you can help me out.

Thanks in advance.

Christian

 

1 answer

Hello Christian,

In our company we are facing a similar problem. Our solution is to use an Issue Event Listener and the logic is complex enough.

Here is why the pure post-functions and conditions approach does not work (and the listener approach is applied):

  • Step 1 is quite straightforward and could be implemented with custom post-functions.
  • Step 2, specifically the requirement to coordinate the  sub-tasks and when they complete to make a transition on the parent task cannot be implemented as post-functions and condition as:
    • in order to coordinate the sub-tasks, they just have to attempt to transition the parent task
    • the parent task should make the transition only if all its sub-tasks are completed. This is a pure condition on that transition
    • attempting a transition, that is not allowed makes JIRA throw an exception, which rolls back the current transaction  - this is the general transition validation mechanism of JIRA
    Then:
    • when the first sub-task completes, a post function on its transition to complete could attempt transitioning also the parent task
    • from the point of view of the sub-task, this transaction should succeed
    • from the point of view of the parent task, this transition is not allowed, its condition fails and the transaction rolls back.

This shows that the pure condition & post-functions approach does not work.

In contrast, the issue events in JIRA workflows are processed out of any transactions, which allows the sub-task's transition to complete successfully, isolated from the transition (if any) of the parent task.

Then, a Issue Event Listener approach could be:

  • listen for a General Issue Event (#13),
    • if the firing issue is a sub-task (of your specific types) then
      • find the workflow of the issue that fired the event
      • if it is a transition to DONE state, then:
        • find the parent task
        • transition it

The knowledge how to implement such logic is quite well provided in the recipes in "Jira 5.X Development Cookbook" by Kuruvilla.

Dear Rusi,

Thank you for you answer.

I tried to implement step 1 with post function by I could not manage it. I search all around and there should be a 'create sub-task' post function which I do not have and could not find.  Could maybe be be a bit more clear how could I implemented it ?

 

There's no "create sub task" function built into JIRA, you will need to find/write an add-on to provide it.  There's several in the marketplace (free too), but as you've got other requirements you probably need to code for, you might find it easier to just get the Script Runner add-on.

Hello Christian,

We had experimented with Bob Swift's plugin: https://marketplace.atlassian.com/plugins/org.swift.jira.cot/server/overview  before we decided to move to Listener approach.

With best regards

Rusi

 

 

Create on Transition for JIRA can certainly do the subtask creates (How to create multiple issues) but you will need a listener (like Script Runner) to all the other things you want to do.

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,382 views 21 17
View question

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