It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to check if subtask exists ?

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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you