Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Groovy - how to check if an issue is a sub-task


I am building a custom scripted validator in Groovy and within my script I need to identify whether the current issue is a type of sub-task.  Is there a way I can check this?

1 answer

1 vote

Hi @Graeme Johnson 

The sure is a way to check this and it's very easy:

if( issue.issueType.subTask){
//do something for sub-task issue types
} else {
//do something for parent issue types

Thanks, that worked a charm.  

What if we want to check if current issue contains a particular Sub-Task named "abc" ?

You could try something like this:

def abcSubtaskFound = false
abcSubtaskFound = issue.subTaskObjects.any{ == 'abc'}

Or as a oneliner:

def abcSubtaskFound = issue.subTaskObjects && issue.subTaskObjects.any{ == 'abc'}

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events