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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How do I create a dynamic select list of all non-archived projects within my Jira instance?

I'm trying to create a single select list with a list of the active projects with my Jira instance. There are around 60 projects at the moment, and they all have unique names/keys. So far, I've tried using scriptrunner to create a scripted field, but when that didn't work I moved onto a behaviour instead. Ideally, I would want this field to update itself whenever a user interacts with it, and I want to pull this information directly from Jira itself. My team do not use the built-in archiving process in Jira, instead, we assign it to an archived permission scheme, as you can see in the code below.

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def cfManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def permSchemeManager = ComponentAccessor.getPermissionSchemeManager()
def prjManager = ComponentAccessor.getProjectManager()

final singleSelectName = 'Project Name'

def singleSelectField = cfManager.getCustomFieldObjectsByName(singleSelectName)[0]
def formSingleSelect = getFieldByName(singleSelectName)

def config = ComponentAccessor.fieldConfigSchemeManager.getRelevantConfig(issueContext, singleSelectField);
def options = optionsManager.getOptions(config)

def arch = permSchemeManager.getSchemeObject("Archived Permission Scheme")
def archivedPrjs = permSchemeManager.getProjects(arch).toArray()
def archivedPrjSize = archivedPrjs.size()
for (int i = 0; i < archivedPrjSize; i++) {
archivedPrjs[i] = archivedPrjs.getAt(i).toString().split(':')[1].substring(1)
def projects = prjManager.getProjects().toArray()
def projectsSize = projects.size()
for (int i=0; i<projectsSize;i++){
def currentPrjKey = projects.getAt(i).toString().split(':')[1].substring(1)
projects[i] = prjManager.getProjectByCurrentKey(currentPrjKey).name
for (int i = 0; i < archivedPrjSize; i++) {
for (int j = 0; j < projectsSize; j++) {
if (archivedPrjs[i] == projects[j]) {
projects[j] = null
for (int i = 0; i< archivedPrjSize; i++) {
projects = projects.tail()
projectsSize = projects.size()
def projectsMap = projects.collectEntries( {


Can someone suggest a better way to do this, as I am currently stumped as to the best solution?

Many thanks,


0 answers

Suggest an answer

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

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

146 views 1 8
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