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

Need a Groovy Script for Validating multi-checkbox field or Current user is in Admin role Edited

Can any one provide Groovy Script

Need a validator Script for. 


1. All the check boxes in the field are selected ( or ) Current user is in developer role in project.


Both the conditions need to be in the script.

Tried few scripts but the selection of all the checkboxes wont work.


1 answer

1 accepted

0 votes
Answer accepted

A checkbox returns a list of selected options.

You'll need to compare that list of selected (checked) options against the list of available options for that field in the current context.

This should work in a simple scripted validator (in your workflow)

import com.atlassian.jira.component.ComponentAccessor
//for this you'll need a customfield object for the checkbox field
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName('my checkbox field')
//So that you can get the configuration context
def config = cf.getRelevantConfig(issue)
// and the list of associated options
def cfOptions = ComponentAccessor.optionsManager.getOptions(config)

//then, for good measures, get the list of values in a sorted order so you can compare them. Sorting may not be necessary, I suspect the order will alway be the same, but it can't hurt
cfOptions*.value.sort() == cfValues['my checkbox field']*.value.sort() || isUserMemberOfRole('Developers')

Thank you,


worked out with another script and tested this   no defects.

Suggest an answer

Log in or Sign up to answer

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