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!


Get screen list for custom field with ScriptRunner

Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jan 27, 2023


We are performing a cleanup of our gigantic Jira Data Center instance (v9.2.0).

This particular piece is to cleanup custom fields with global contexts and assign specific projects to the contexts.

We have thousands of fields, which we're also cleaning up to get rid of. Some of the custom fields have hundreds of projects with screens associated with a custom field. Clicking in that tiny box in the UI is anxiety provoking at best.


I want to supply the custom field and ultimately get a list of projects with screens associated with the field.

Not required

I do not want the list of fields associated with a project. I want the opposite.

I also do not want to find the projects for issues that have values for the custom fields. I already have that.


Here's what I've tried:


I can get the methods to work except for returning the associated screens (frustrating!)
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenManager
import com.atlassian.jira.web.action.admin.customfields.AssociatedScreensForCustomField

Long customFieldID = 32673

CustomFieldManager customFieldManager = ComponentAccessor.customFieldManager
CustomField customField = customFieldManager.getCustomFieldObject(customFieldID)
FieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager()
AssociatedScreensForCustomField asfcf = new AssociatedScreensForCustomField(customFieldManager, fieldScreenManager)
def fieldScreenTabs = asfcf.getAssociatedScreens()

return fieldScreenTabs

I get this returned


If I can get the screens (or FieldScreenTabs), I think I can work my way through the rest of the objects to get to the projects.

Ideally going directly to the associated projects would be the best thing.


I tried to use these, but ScriptRunner doesn't seem to like to even import anything from com.atlassian.pageobjects:


Field contexts

The CustomField.getAssociatedProjectObjects() gets the projects in a field context. I'm cleaning up global contexts, so that won't work.


I tried finding an association in the database maze, but to no avail. Google has not helped either.


Anybody have any ideas of how to get what I'm looking for?

1 answer

0 votes
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 14, 2023 • edited

Just ran into the same issue and came across your post while I was searching for an answer. Took a little bit to figure out, but I finally go this working. See the ScriptRunner script below (updated with dynamic field to select the Custom Field):

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.project.Project
import com.atlassian.jira.issue.fields.screen.FieldScreenManager
import com.atlassian.jira.issue.fields.screen.FieldScreen
import com.atlassian.jira.issue.fields.screen.FieldScreenTab
import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager
import com.atlassian.jira.issue.fields.screen.FieldScreenScheme
import com.atlassian.jira.issue.fields.screen.issuetype.IssueTypeScreenSchemeManager
import com.atlassian.jira.issue.fields.screen.issuetype.IssueTypeScreenScheme
import com.onresolve.scriptrunner.parameters.annotation.CustomFieldPicker

@CustomFieldPicker(label = 'Custom Field', description = 'Pick a custom field', placeholder='Select custom field')
CustomField field

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
FieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager()
FieldScreenSchemeManager fieldScreenSchemeManager = ComponentAccessor.getComponent(FieldScreenSchemeManager)
IssueTypeScreenSchemeManager issueTypeScreenSchemeManager = ComponentAccessor.getComponent(IssueTypeScreenSchemeManager)

Collection<FieldScreen> fieldScreens = fieldScreenManager.getFieldScreens()

Collection<Project> projects = []

fieldScreens.each { fieldScreen ->
List<FieldScreenTab> tabs = fieldScreen.getTabs()

tabs.each { tab ->
if (tab.isContainsField(
Collection<FieldScreenScheme> fieldScreenSchemes = fieldScreenSchemeManager.getFieldScreenSchemes(fieldScreen)

fieldScreenSchemes.each { fieldScreenScheme ->
Collection<IssueTypeScreenScheme> issueTypeScreenSchemes = issueTypeScreenSchemeManager.getIssueTypeScreenSchemes(fieldScreenScheme)

issueTypeScreenSchemes.each { issueTypeScreenScheme ->
projects = projects + (issueTypeScreenScheme.getProjects() as Collection<Project>)

projects.each { project ->


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events