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

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

Atlassian Community Events