Create 3 auto sub-task when the parent status changes

Christian Ggrigoras January 23, 2016

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

0 votes
Rusi Popov
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.
January 24, 2016

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.

Christian Ggrigoras January 24, 2016

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 ?

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 24, 2016

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.

Rusi Popov
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.
January 24, 2016

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

 

 

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
January 24, 2016

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