Transition Parent Issue *Only* When Certain Issue Sub-Task Types Are Done

Malik Graves-Pryor March 3, 2014

Here's a bit of a compound conundrum I'm trying to resolve.

User Stories have a user story workflow.

The Engineering Sub-Task type has an engineering sub-task workflow.

The QA Sub-Task type has a qa sub-task workflow.

I have the following compound criteria to meet:

  1. When at least one Engineering Sub-Task or QA Sub-Task type is set to "In Progress", auto transition the parent User Story to Step 2.

  2. Only when all Engineering Sub-Task types are "Done", auto transition the parent User Story to Step 3. This happens regardless of the status of the QA Sub-Tasks.

  3. Only if all Engineering Sub-Task types and QA Sub-Task types are done, allow transition of the User Story from Step 3 to Step 4.

I've seen a few workflow plugins that allow transition of the parent if *all* sub-task types are set to a particular status or resolution. That would violate #2, however.

Are there any plugins that allow you to segregate sub-task types for different transition thresholds?

I've been searching and thus far I haven't found any.

From a logic perspective it could work like this:

  • Post Function on the Engineering Sub-Task workflow for the "Done" transition:
    • If all sibling Engineering Sub-Task types are "Done", auto-transition the parent issue from Step 2 to Step 3 (#2 in the compound criteria I listed above)
    • If all sibling Engineering Sub-Task types are "Done" and QA Sub-Task types are "Done", allow transition from Step 3 to Step 4.

NOTE: There is no allowed transition of the story from Step 2 to Step 4. That is handled at the User Story level.

Does this make sense? Any plugins you can think of to assist in this?

It seems JIRA Misc Workflow Extensions and JIRA Workflow Toolbox thus far have come closest, but no cigar on the last bits of these requirements.

Any help is greatly appreciated.

Sincerely,

Malik Graves-Pryor

4 answers

1 accepted

5 votes
Answer accepted
Fidel Castro March 4, 2014

Hi Malik,

Your requirements can be implemented in JIRA Workflow Toolbox using two features of this plugin:

  • Validation on subtasks: to be inserted in "From Step 2 to Step 3" and "From Step 3 to Step 4" transitions of Story Workflow, in order to prevent transition ejecutions if criteria 2 and 3 are not met. This validators work always, i.e. in human triggered transitions or post-function triggered transtions.
  • Copy parsed text to a field to write on virtual fields "Parent's issue status" and "Parent's issue status (delayed writing)": when you write the name of a status into these virtual fields (provided by the plugin) you are transitioning parent's issue to that status, provided there is a transition in parent's workflow from current status to desired status, and all conditions and validators of that transition are met. The difference between them is that "Parent's issue status (delayed writing)" waits for subtask transition to be executed, so that it is in the new status before parent transition is attempt. This way validator "Validation on subtasks" won't block parent transitioning if triggering subtask was the lasting Engineering Sub-Task to be moved to Done status.

Now I explain in detail how to do it. I'm considering that "Done" is a status in subtasks workflows, but if it were a Resolution value it wouldn't be a problem.

1.- Post-function "Copy parsed text to a field" in transition "Start Progress" in "Engineering Sub-Task" and "QA Sub-Task" workflows

This post-function will auto-transition parent issue to "Step 2" when any of the subtasks are moved to status "In Progress".

Use the configuration shown in the screenshot. Notice that "Status of Step 2" must be replaced with the name of the status associated with Step 2:

2.- Post-function "Copy parsed text to a field" in transition to status "Done" in "Engineering Sub-Task" workflow

This post-function will auto-transition parent issue to "Step 3" when the last Engineering Subtask is moved to status "Done". This post-function work as a team with validator "Validation on subtask" in transition "From Step 2 to Step 3" in Story workflow.

Use the configuration shown in the screenshot. Notice that "Status of Step 3" must be replaced with the name of the status associated with Step 3:

3.- Validator "Validation on subtasks" in transition "From Step 2 to Step 3" in Story workflow:

This validator will prevent execution of transition from Step 2 to Step 3 unless every Engineering Subtask is in status "Done":

4.- Validator "Validation on subtasks" in transition "From Step 3 to Step 4" in Story workflow:

This validator will prevent execution of transition from Step 3 to Step 4 unless every Engineering Subtask and QA Subtask is in status "Done":

Regards,

Fidel.

Malik Graves-Pryor March 4, 2014

This is exceedingly comprehensive, far outstripping what I was expecting.

I salute you sir!

Sincerely,

Malik Graves-Pryor

Malik Graves-Pryor March 5, 2014

Hi Fidel,

I found one issue with this. The steps you've outlined function if the user story transition requiring "Engineering Sub-Tasks" to be complete (Step 3) is not an auto transition.

The validation will fail as expected, and once all "Engineering Sub-Tasks" are done, then and only then can the workflow step be executed. But the execution has to be done manually. It won't automatically transition.

Does this make sense?

Sincerely,

Malik Graves-Pryor

Malik Graves-Pryor March 5, 2014

I've finally reduced the issue down to its component parts.

The story validation functions as expected if there are only "Engineering Sub-Tasks". However, as soon as I add another type of Sub-Task to the user story, the validation function in the user story transition ceases to work.

I followed the instructions above. Any ideas?

Sincerely,

Malik Graves-Pryor

Fidel Castro March 5, 2014

Hi Malik,

I have implemented the whole configuration in a JIRA 6.2 instance with Jira Workflow Toolbox 2.1.14 and it's working perfectly.

Did you left parameter "Allow unselected issue types" unchecked in step 3? This parameter must be checked in both steps 3 and 4.

Regards,

Fidel

Malik Graves-Pryor March 5, 2014

Hi Fidel,

Yes, I followed your instructions and triple checked to make sure I did everything as stated.

That said, I am running 2.1.14 on JIRA 6.1.17. I've requested devops to upgrade our JIRA instance to 6.2. It's possible that might be the issue?

Sincerely,

Malik Graves-Pryor

Malik Graves-Pryor March 5, 2014

One last bit, I checked Step 3 and 4. They are identical except Step 3 only has Engineering Sub-Tasks checked. Step 4 has Engineering Sub-Tasks and QA Sub-Tasks checked.

Everything else is identical.

Please see the attached screenshots from Step 3 and 4 in the user story workflow, and the post-function in the sub-task workflow, in order

Fidel Castro
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.
March 6, 2014

Malik,

Did you try to execute manually transition "Engineering Peer Review" in "Story" workflow? It should allow execution only when all "Engineering Sub-Task" are in status "Done", regardless of the status of any other subtask types (QA Sub-Task or any other issue type) it might have.

It should behave like I described. In case it doesn't, please describe the failling issue: issue type, status, and subtasks issue types and statuses.

On the other hand, it's preferred to execute post-function "Copy parsed text to a field" before system's default post-functions, in your case move it to first position in execution order.

I don't think this problem is caused by the JIRA version your are using, since the plugin is fully compatible with JIRA 6.x

Regards,

Fidel

Malik Graves-Pryor March 6, 2014

Hi Fidel,

I tried manually executing the transition and it gives me the validation error even though all Engineering Sub-Tasks are in "Done" status. There are QA Sub-Tasks in "To Do" status at the time.

If I delete the QA Sub-Tasks and try to transition the story again, it works without problem.

The story is "In Progress", the Sub-Tasks are Engineering Sub-Task and QA Sub-Task, and their respective statuses are "Done" and "To Do".

That said, I changed the execution of the post-function so that it goes first. It didn't make a difference unfortunately. We also did the upgrade and nothing changed either.

Is there anything else you'd like to see in my installation/configuration?

Your help is definitely appreciated in getting this functioning.

Sincerely,

Malik Graves-Pryor

Fidel Castro
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.
March 6, 2014

Malik,

I can't figure out what it's happening. "Validation on linked issues" has no reported issues and the same configuration is working perfectly in my jira instance.

Please, try moving "QA Sub-tasks" to "Done" status, i.e., all "QA Subtaks" and "Engineering Sub-tasks" in "Done" status, and let me know if you can execute transition in "Story" workflow from "In Progress" to "Engineering Peer Review".

BTW, which version of the plugin are you using?

Anyway, I'm available for a Skype meeting to discuss the issue.

Regards,

Fidel.

Malik Graves-Pryor March 7, 2014

Hi Fidel,

I'm definitely able to execute the transition of the story from "In Progress" to "Engineering Peer Review" if all QA Sub-Tasks are "Done" along with Engineering Sub-Tasks, or if there are no QA Sub-Tasks.

That saiid, I'm using version 2.1.14.

I'm on Skype, malikgp. When would you like to chat? Your support is greatly appreciated.

Sincerely,

Malik Graves-Pryor

Fidel Castro
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.
March 7, 2014

Please, try exchanging configurations in both validations, i.e., the one with both isssue types checked ("Engineering Sub-tasks" and "QA Sub-tasks") now will get only "Engineering Sub-tasks", and viceversa.

Perhaps, we are having some kind of misunderstanding.

Malik Graves-Pryor March 7, 2014

Hi Fidel,

I gave that a whirl and no dice. Would it be possible for me to share my screen with you so can you see what I've got in place?

Sincerely,

Malik Graves-Pryor

Fidel Castro
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.
March 7, 2014

Hi Malik,

Definitely you found a bug in "Validator on subtasks". I have released version 2.1.15_beta_1 fixing the problem. "Condition on subtasks" was also affected by the problem.

This version only differs from 2.1.14 in this fix, so you can use it in production environment securely.

Regards,

Fidel.

Malik Graves-Pryor March 7, 2014

Hi Fidel,

After extensive testing I can confirm that the 2.1.15_beta_1 version has resolved the issue. The workflow is working as expected.

Thank you so much!

Sincerely,

Malik Graves-Pryor

Chris Megson January 4, 2016

What happens after a transition is complete and a subtask is reopened? Or if you want to return the parent task to the previous status?

Fidel Castro
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 4, 2016
0 votes
Nikola Ivanov July 10, 2017

Hi Malik,

 

I know it has been 3 years and I'm sorry for waking up this up ....

 

I have been trying all day to achieve this with JMWE and since this post is already indexed by google I wanted to link the solution from here for people looking for help.

https://github.com/weboholic/userscripts/blob/master/transition.parent.onsubtask.conditional.groovy

 

Cheers,

Nikola

Simon Kälberer May 8, 2018

Hey guys,

first of all, thanks a lot for that topic and the linked solution.

 

I changed the linked solution as we don't have any specific subtask-types.

Collection subTasks = parentIssueObject.getSubTaskObjects()
def condition = true
subTasks.each{subtask ->
      if (subtask.statusObject.name != "done") {
      condition = false
    }
  }
return condition

 

I have tested the script and it is working fine in the JMWE Groovy Script Tester. But the post function is not updating transition the parent issue.

 

Any ideas?

 

Cheers,

 

Simon

Simon Kälberer May 8, 2018

I got a response from support. The post-function had to be moved to the end of the list of post functions so that the transition of the subtask is executed before the post-function is executed for the parent issue

Tayler February 19, 2019

I tried this solution, but it's moving my story when the first sub-task is moved, but I don't want it to move until the last one has moved to Done. Any idea what's not working? 

https://github.com/weboholic/userscripts/blob/master/transition.parent.onsubtask.conditional.groovy

0 votes
David _old account_
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.
March 4, 2014

You can indeed achieve the conditional automatic parent transitions you're mentioning using JIRA Misc Workflow Extensions. You can use the "Transition Parent Issue" post-function, using its conditional execution parameter (a Groovy formula).

However, the plugin currently doesn't include a scriptable Condition, although that is certainly a good idea for an enhancement, which you can request at https://innovalog.atlassian.net/secure/CreateIssue.jspa?pid=10793&issuetype=2

Malik Graves-Pryor March 4, 2014

Hi David,

I tried to create an issue but it says I do not have permission to do so in that project. Any ideas?

Sincerely,

Malik Graves-Pryor

David _old account_
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.
March 5, 2014

Hi Malik,

this is caused by a bug in the latest JIRA OnDemand version that was deployed by Atlassian a few days ago. I have reported the issue to Atlassian and am waiting for a fix.

In the interim, I believe I have fixed your particular access rights so you should now be able to create issues.

Thanks for reporting this,

David.

David _old account_
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.
March 5, 2014

Hi again Malik,

Atlassian has fixed the issues we were facing on https://innovalog.atlassian.net

All new and existing users should have regained access to issue creation, as well as the Confuence pages.

David.

Malik Graves-Pryor March 5, 2014

Thanks David, I'll file a request for this feature

0 votes
Radu Dumitriu
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.
March 3, 2014

Try Jjupin. You can put any conditions you want. An example for subtasks is here: http://confluence.kepler-rominfo.com/display/TR/Autotransitioning+subtasks

Of course, you must modify to match your conditions and apply the stuff on parent, not on the subtasks, but you will get the idea.

You can also try ScriptRunner (it's free) if you like groovy and want to deal with Jira internals yourself.

Malik Graves-Pryor March 4, 2014

Hi Radu,

I had not looked at ScriptRunner before, but I will definitely do now. It looks quite powerful!

Sincerely,

Malik Graves-Pryor

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events