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

Get all custom fields of a project using Scriptrunner

Need help with scripting to get all the custom fields present on the screens for a particular  project for a specific issuetype, including the transition screens.

Can anyone help ?

The associations between various schemeManagers (IssueTypeScreenScheme , or FieldScreenScheme ) is very confusing.




2 answers

Hi @Shreyance Shaw,

I came up with the script below that you can run in ScriptRunner's Script Console.

What it does is that it gets all the custom fields for all issue types of the project & then compare them with all the fields (system + custom fields) on every screen (whether the screens are applied to the workflow transition or not), then return only the custom fields as the final output.

import com.atlassian.jira.component.ComponentAccessor 
import com.atlassian.jira.issue.fields.screen.*

import org.apache.log4j.Level
import org.apache.log4j.Logger
def log = Logger.getLogger(getClass())

//change the project key to your own value
def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey("PX")
def projectId = project?.id
log.debug "Project: $project.key | $ | $projectId"

//get all the custom fields for the project & all issue types
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customFields = customFieldManager.getCustomFieldObjects(projectId, []).toString()
log.debug "Custom Fields: " + customFields

def fieldScreenManager = ComponentAccessor.getFieldScreenManager()
def fieldScreens = fieldScreenManager.getFieldScreens()
def output = ""
log.debug "Screens: " +

fieldScreens.each { fieldScreen ->

def tabs = fieldScreen.getTabs()
output = output + "<h1>" + + "</h1>"

tabs.each { FieldScreenTab tab ->

output = output + "<h2>" + + "</h2>" + "<h3><u>List of Custom Fields:</u></h3>"
def items = tab.getFieldScreenLayoutItems()

items.each { FieldScreenLayoutItem item ->

if (item.getOrderableField()) {

if (customFields.contains(item.getOrderableField().name)) {

output = output + "<p>" + item.getOrderableField().name + "</p>"

return output 

You can of course tailor this script to your requirements.

.getCustomFieldObjects() method allows you to specify the issue type of interest. Some of the transitions in your workflow may not have a transition screen. If you know the exact screen id that you're looking at, you may change the fieldScreens.each iteration (keep the code block) to:

//10000 is my screen id
def fieldScreen = fieldScreenManager.getFieldScreen(Long.parseLong("10000"))

if (fieldScreen) {

//code block


and you'll get the custom fields that present on a specific screen.


I hope that this helps!

If this response has answered your question, please do mark it as Accepted to make it easier for other users to discover potential solutions to their questions.

Hi Shreyance,

A similar question like this was asked earlier and answered.

You can find the post on this link

I hope this helps to solve your question. :)

I am looking forward to your feedback.


Thank you and Kind Regards,

Suggest an answer

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

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

549 views 15 18
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