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 { it.issueTypeObject.name == '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.
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
its typechecking error, don't pay attention
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.