Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do we, using JMWE to do "if all subtasks are done move also the parent issue"

raphy_thomas August 15, 2019

"if all subtasks are done move also the parent issue"

Hello
I need your help,
we are using Jira cloud and we have installed addon called JMWE

I am trying to without success, can you help me?

I need to know what to select for post function (Transition parent issue )
and what to write in the condition field
{{Issuetype == sub-task | Status == Reviewed }} but how do i say "IF ALL SUBTASKS have status = X then move Parent issue (user story) to status =X" ???
thank you very much

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
August 15, 2019

Hi,

The most common approach to this requirement is actually to use a transition parent issue post-function on the sub-tasks' Close transition without conditional execution, and add a"sub-tasks blocking condition" on the Close transition of main issues to prevent them from being closed until all their sub-tasks are closed. 

Note that this works just fine if issues and their sub-tasks share the same workflow. 

Would that work for you?

raphy_thomas August 15, 2019

Hello, Thanks for the reply but that does not help me with my problem

"IF ALL SUBTASKS have status = X then move Parent issue (user story) to status =X" ???

They dont share the same workflow and the status is not for closed it is from To DO to In priogress and this should slove it for all states

David Fischer
Community Champion
August 16, 2019

Yes it does. 

First of all, I did mention two workflows in my explanation, I just added that it will also work if the two workflows are the same. 

Then, it will try to trigger the transition on the parent even time a subtask is transitioned by the subtasks blocking condition on the parent transition will block the transition unless the subtasks are all in the desired status. Which is exactly what you need. 

Also, you can obviously replace "Closed" with any other status - in your case "in progress". 

Can you try that?

0 votes
Radhika Vijji _Innovalog_
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.
August 16, 2019

Hi,

What do you mean by "this should solve it for all states"? Do you want this implementation in all the transitions? If yes, you can add the Transition parent issue post-function to the transition on the Sub-task workflow with a conditional execution. For example, you want the parent to move to "To Do" to "In Progress" when all the sub-tasks move from "To Do" to "In Progress", then, you should:

  1. Add the "Transition Parent Issue" post-function to the "Start Progress" transition of the Sub-task workflow.
  2. Input Start Progress in Transition.
  3. Select conditional execution and input the following script:
{% set subtasks = parentIssue | subtasks %}
{% set trigger = true %}
{% for subtask in subtasks %}    
{% if subtask.fields.status.name != "In Progress" %}        
{% set trigger = false %}    
{% endif %}
{% endfor %}
{{ trigger }}

Save the post-function, repeat the same for all the other transitions of the Sub-task workflow.

Regards,

Radhika 

raphy_thomas August 16, 2019

Hello, thanks for the replay, but it does not seem to work. is it because the User story and the subtask have different workflows? 
the Status and states are the same, it it just that the User story workflow have a trigger in the early state to fire a screen pop-up before moving from New to to do...

Radhika Vijji _Innovalog_
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.
August 16, 2019

Having different workflows is not an issue. But having a screen might be. Does the screen have any mandatory fields to be filled during the transition Screen? If yes, then you should provide values to those fields in the post-function configuration under the "Transition screen" section.

Regards,

Radhika

raphy_thomas August 16, 2019

I am moving the sub-tasks from Review to Release using the button Reviewed. 
Reviewed have id 21 and i am adding it in the top of the post function and at the button of the paste your script. 

{% set subtasks = parentIssue | subtasks %}
{% set trigger = true %}
{% for subtask in subtasks %}    
{% if subtask.fields.status.name != "RELEASE" %}        
{% set trigger = false %}    
{% endif %}
{% endfor %}
{{ trigger }}
raphy_thomas August 16, 2019

No, the screen is no issue here, for sure

raphy_thomas August 16, 2019

Transition 21 will be triggered on the parent issue of the current issue (subtask). 
Run as current user.

Run this post-function conditionally:

{% set subtasks = parentIssue | subtasks %}
{% set trigger = true %}
{% for subtask in subtasks %}    
{% if subtask.fields.status.name != "RELEASE" %}        
{% set trigger = false %}    
{% endif %}
{% endfor %}
{{ trigger }}
raphy_thomas August 16, 2019

aslo, i moved this post function on the buttom of all the post functions. 
Still not firing

Radhika Vijji _Innovalog_
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.
August 16, 2019

Can you raise a support request with us here so that we can look into the details?

Regards,

Radhika

raphy_thomas August 16, 2019

Done!
SMWEC-1262

David Fischer
Community Champion
August 16, 2019

Status names are usually not in all uppercase. They are displayed in uppercase on the issue view but if you look at the workflow editor or on the Statuses admin screen, you'll see the real transition name (which is case-sensitive)

So, in the script, replace "RELEASE" with "Release" or whatever the real status name is. 

But as I said above, using a subtasks blocking condition is a better and easier solution. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events