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

How to identify all subtasks with proper value in custom field

I would like to identify all subtasks under the user story with proper value in the custom field, The idea is that if such exists than the transition should be disabled.

I have written something like that:


import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()

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

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

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


Unfortunately, the list of subtasks is empty and looks that it.getCustomFieldValue(cf) == "Development test" doesn't work. Could you help me with fixing it ?


Thanks in advance.

1 answer

1 accepted

1 vote
Answer accepted

looks like "Test Type" is a select type custom field, so when you are trying to compare it to string, it fails hence finding no such subtasks

try replacing it with 

it.getCustomFieldValue(cf)?.value == "Development test"

that should do the trick

When I changed it I have received an error "No such property: value for class"

its typechecking error, don't pay attention

It works, thank you a lot

Suggest an answer

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

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

320 views 0 10
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