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

Behaviour groovy - Hide values of a select list for a group



I'm a total groovy beginner !

As the title says, I need to hide values of a select list for a group.

This select list has a lot of values like 60-80 and I need to hide all values starting with CC* (around 20-30 values), need to hide these to everyone except a specific group 'DAF'.

I know Behaviour allows to except so I think the script should only hide all values CC*, then I add the exception group DAF.

I just have a draft with elements I gathered everywhere, could you please help me ?


import com.atlassian.jira.component.ComponentAccessor

//def courrier = getFieldById("customfield_10500")

def CC = 'CC$'
def issue = ComponentAccessor.getIssueManager().getIssueObject("NS-15") // get issue where field exist
def courrier = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Type de Courrier")
def optionsManager = ComponentAccessor.getOptionsManager()
def options = optionsManager.getOptions(courrier.getRelevantConfig(issue))
options.each {
//if (it.value == "CC1 - courrier 1" || it.value == "CC2 - courrier 2" || it.value == "CC3 - courrier 3"){
//if (it.value =~ 'CC$'){
if (it.value == CC){



Thanks !


2 answers


actually this script is not good enough, as it also shows all disabled elements of my list ... :(

Help anyone ?

Once again I finally found help within my team, this one script should do the job and be useful to others (beginners) :


//Script to hide some values starting with CC*, in a select list
//With Behaviour, just use an exception/allowance to restric usage to users/groups

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.issue.customfields.option.Option

def mailCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("My mail select list field")
def mail = getFieldByName("My mail select list field") // Get the select list field
def optionsManager = ComponentAccessor.getOptionsManager()
def options = optionsManager.getOptions(mailCF.getRelevantConfig(issueContext))
def CCoptions = options.findAll { item -> !item.toString().startsWith("CC")} // Using the "!" character allows to do the opposite/contrary


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

58 views 0 1
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