How to check if subtask exists ?

Galas September 22, 2019

I would like to have the transition visible only if appropriate subtask exists and it is resolved.

I wrote:

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName("Test type")

def subtasks = issue.getSubTaskObjects().findAll { it.issueTypeObject.name == 'Sub Test Execution' && it.getCustomFieldValue(cf)?.value == "Development test"}

issue.subTaskObjects && !subtasks.any { subtask -> !subtask.getResolutionObject() }

But looks that issue.subTaskObjects (in my opinion it should check if such subtask exists) doesn't work. 

Could you help me ?

Thanks in advance

1 answer

1 accepted

0 votes
Answer accepted
Galas September 24, 2019

I have found the solution: It shouldn't be issue.subTaskObjects but subtasks and it works

Harish_Kumar March 1, 2020

Hi @Galas 

Where you have put this code to work as expected ?

Thanks , Harish Kumar

Pratibha Tambakad March 15, 2023

Hello Gala,

 

Could please how does it worked, whats the code you used?

Suggest an answer

Log in or Sign up to answer