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

ScriptRunner Validator - Subtasks have Select CF initialized


Im trying to make a validation in a transition where the parent check if all the sub-tasks have a cf: select list, initialized with a value.

Actually I have done this:

import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObjectByName("UO type")

if (! issue.isSubTask()) {
return true

def selectedValue = issue.getCustomFieldValue(cf) as Option
issue.subTaskObjects.every {selectedValue != null}

-> But its not working.

Thanks in advance.validator.png


1 answer

1 accepted

1 vote
Answer accepted

The issue is in your last 2 lines.

selectedValue is specific to the parent issue, attempting to check this for a null value in the every{} block is not achieving what you think.

Here is the complete logic that you are trying to accomplish if I understand correctly

def UOTypeValue = subTaskIssue.getCustomerFieldValue(cf)
UOTypeValue != null

 And it can be further simplified because of the built-in groovy truthiness


Hello @Peter-Dave Sheehan , thanks for the corrections and your quick response.

This helps me a lot! :)


Have a nice day.

Like Peter-Dave Sheehan likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

159 views 1 3
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