How to retrieve a particular Custom field value from the database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
To retrieve a particular Custom field value for a particular Issue via an SQL query to the database.
Solution
Run the following query:
1
select cfv.* from customfieldvalue cfv join customfield cf on cfv.customfield = cf.id where cf.cfname = '<Custom Field Name>' and cfv.issue = (select jiraissue.id from jiraissue join project on jiraissue.project = project.id where project.pkey = '<Project Key>' and jiraissue.issuenum = '<Issue Num>');
Replace '<Custom Field Name>' , '<Project Key>' ,'<Issue Num>' with the Custom field name,Project key,Issue Number that you wish to use.
Project Key can be retrieved using How to get project id from the Jira User Interface
ℹ️ This is tested using PostgreSQL. Please modify it according to the needs of your database.
Was this helpful?