Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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 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
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

142 views 1 12
Read article

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