How to find id for custom field(s)?
Summary
This article described several methods to obtain custom field IDs for Jira and Jira Service Management products. Having the custom field ID can be useful when working with API payloads or running SQL queries (Server or Data Center), which require the ID as opposed to the field name.
Using Jira Home Directory and DB Browser plugin
This step is only available in our Server and Data Center products.
- To run the following steps, make sure you have the JIRA Administrator permission.
- Install Jira Home Directory And DB Browser.
Navigate to the Db Console.
Select the
customfield
table and Execute.
Using URL
Please note, the Administer Jira Global permission is necessary to complete these steps.
- Navigate to Settings ( ) > Issues > Custom fields under the Fields section
- Click on the More (⋯) icon to the right of the custom field you are obtaining the ID
- Select the View field information option
- Observe the URL in your browser, which will contain the ID of the field:
In the above example, the custom field ID is 10026.
Using API
Using the Get Fields Jira Cloud API endpoint, custom fields can be returned in a list. Please see the Cloud REST API documentation or the JIRA Server REST API references 8.13.9/8.18.1 and earlier or 8.13.10/8.18.2 and later for additional examples and rules relating to using this endpoint. The returned JSON data will need to be filtered to identify the field you are looking for and its ID.
Sample response from the API:
{
"id": "customfield_10026",
"key": "customfield_10026",
"name": "Approvals",
"untranslatedName": "Approvals",
"custom": true,
"orderable": true,
"navigable": true,
"searchable": true,
"clauseNames": [
"Approvals",
"Approvals[Approvals]",
"cf[10026]"
],
"schema": {
"type": "sd-approvals",
"custom": "com.atlassian.servicedesk.approvals-plugin:sd-approvals",
"customId": 10026
}
}
Export to XML
The custom field IDs used by issues can be retrieved by exporting the issue to XML within the Jira and Jira Service Management user interface. This method will show field IDs for fields present on the issue only.
- Open up the issue that you want to get the custom field ID for
- Click the Actions (⋯) icon towards the top right corner
- Select the Export to XML option, which will open up a new tab with the issue details in XML format
- Search for the field name to identify it's custom field ID
<customfield id="customfield_10026" key="com.atlassian.servicedesk.approvals-plugin:sd-approvals">
<customfieldname>Approvals</customfieldname>
<customfieldvalues> </customfieldvalues>
</customfield>
In the above example the custom field ID is 10026 for the Approvals field.
From Database
Using the below DB query:
jiradb=# select id from customfield where cfname='Approvals' ;
id
-------
10026
(1 row)
jiradb=#