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

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

Atlassian Community Events