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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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

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
AUG Leaders

Atlassian Community Events