Transition parent to same status as subtasks when all subtasks were moved

Deleted user March 7, 2019

Hello Community,

  • I have two Workflows, one for Task-Type and one for SubTask-Type.
  • Task WF Status: Open-InProgress-In Review-Reviewed-Implemented-Tuned-Tested-InProd
  • SubTask WF has Open-Tuned-Tested-InProd Status.

So much for the Basics.

Within the SubTask WF, in the transition from Open to Tuned (ID 131), I added the  Transition parent issue (JMWE add-on) function with the following condition:

Transition parent to Task WF Status Tuned (ID 71) when all subtasks are in Status Tuned (ID 131).

def subtasks = issue.subTaskObjects
boolean subtaskStatus = 0
boolean allSubsSameStatus = 0
def subtaskList = []

for (subtask in subtasks){
 if (subtask.status.name == "Tuned"){
  subtaskStatus = 1
  log.info "Set True. Status Subtask is ${subtask.status.name}"}
  
    else{
  subtaskStatus = 0  
  log.info "Set False. Status Subtask is ${subtask.status.name}"}
  
  subtaskList.add(subtaskStatus)
}

def size = subtaskList.size()
log.info "ListSize ${size}"
log.info "List Content: Has each Subtask status tuned? ${subtaskList}"

if(subtaskList.contains(false)){
 allSubsSameStatus=0}
else{
 allSubsSameStatus=1}
 
log.info "Are all Subtasks Tuned? ${allSubsSameStatus}"

allSubsSameStatus

 At the end it triggers "true" and the parent should be moved. I put the Action at the end of the transitioning process (after fire Event). While moving the subtask now, i got:

Error:

Error occurred while storing issue.

Unable to move issues at this time. Please refresh your browser and try again.

Any ideas? (Btw. I got the same issue with script runner (groovy))

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2019

Hi Marie,

do you know that you could achieve the same without any conditional execution script? Just add a "Sub-task blocking" condition to the parent transition from Implemented to Tuned.

And if you really want to use conditional execution instead (because you still want to allow manual Task transition to Tuned even when not all sub-tasks are Tuned), your code is incorrect because the current issue (in the issue variable) is the sub-task being transitioned, not the parent Task. The code you need is:

parentIssue.subTaskObjects.every {it.status.name == "Tuned"}
Deleted user March 7, 2019

Hi David,

thanks for the fast reply. The "Sub-task-blocking" condition still requires a Manual movement of the parent Task, right? I like to have the following:

While moving the last subtask to tuned, it shall automatically move the parent to tuned.

For the scripted condition I'm now able to move 4 of 5 subtasks to the Status Tuned. When I move the 5th one, the parent goes to Status Tuned, but the 5th subtask got the same error as before and is not able to be transitioned.

parentIssue.subTaskObjects.every {it.status.name == "Tuned"}
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2019

Hi Marie,

I suggested replacing the conditional execution script with the Sub-task blocking condition - not replacing the Transition Parent Issue post-function.

As for the error you're getting, make sure you move the Transition Parent Issue post-function to the bottom of the list.

Deleted user March 11, 2019

Sadly the behaviour stayed the same :(

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2019

Hi Marie,

can you open a support request at https://innovalog.atlassian.net/servicedesk/customer/portal/8 ? We'll need to look into your Jira logs, which you might not want to share publicly here...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events