How to get a list of all fields in a project

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud, Server, and Data Center - This article applies equally to all platforms.

Purpose

If you would like to get all fields that belong to a given project in Jira by either using a REST API call or querying the database.

Solution

  • Option 1 - Use a REST API call GET /rest/api/2/issue/createmeta. This API will only return fields that are available on the create screen for the project. As an example, for a project with projectkey=SPB:

    http://jira.com:8080/rest/api/2/issue/createmeta?projectKeys=SPB&expand=projects.issuetypes.fields
  • Option 2 - Query the JIRA database

    • Step 1 - Get the list of IssueTypeScreenSchema for all Projects

      SELECT sink_node_id, pname FROM nodeassociation na JOIN project pr on pr.id=na.source_node_id WHERE na.association_type = 'ProjectScheme' AND na.sink_node_entity = 'IssueTypeScreenScheme' ORDER BY pname ASC;
      
      
      sink_node_id |         pname
      --------------+-----------------------
              10100 | Agile-Project
              10300 | Scrum Project B
    • Step 2 - Get the list of all unique screen elements for IssueTypeScreenSchema

      SELECT DISTINCT(fieldidentifier) FROM fieldscreenlayoutitem JOIN fieldscreentab ON fieldscreentab.id=fieldscreenlayoutitem.fieldscreentab JOIN fieldscreen ON fieldscreen.id = fieldscreentab.fieldscreen JOIN fieldscreenschemeitem ON fieldscreenschemeitem.fieldscreen=fieldscreen.id WHERE fieldscreenscheme IN (SELECT fieldscreenscheme FROM issuetypescreenschemeentity WHERE scheme = 10300) ORDER BY fieldidentifier;
      
      
      fieldidentifier
      ------------------- 
       attachment
       components
       customfield_10400
       customfield_10401
       customfield_10403
       customfield_10405
       customfield_10408
       description
       environment
    • Step 3 - List all the Custom Fields retrieved in the query from step 2:

      SELECT id, cfname FROM customfield WHERE id IN (10400, 10401, 10403, 10405, 10408);
      
      
       id    |        cfname
      -------+-----------------------
       10400 | Epic Link
       10401 | Epic Name
       10403 | number-test
       10405 | issueFunction
       10408 | test-user-field  

Please note: the queries syntax will need to be adjusted depending on the database system being used. 

DescriptionHow to get a list of all fields in a project
ProductJira

Last modified on Aug 31, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.