How to find any custom field's IDs

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Cloud、Server、および Data Center - この記事はすべてのプラットフォームに適用されます。

要約

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.

Inspecting the custom field in the Issue View page

Using Chrome or Firefox, we can utilize the Developer Tools panel in order to quickly identify the ID of a custom field that's present on an issue page.
(info) This option does not require Jira Admin rights.

  1. Access an issue that has the custom field you want to find the id for.
  2. Make sure that the field is filled, so that it shows on the UI.
  3. Right-click on the screen and select "Inspect".
  4. Click on the name of the custom field.
  5. On the Developer Tools panel, you should see the name and ID for your custom field at the end of the thread. Example:

    issue-field-heading-styled-field-heading.customfield_XXXXXX

Using the Advanced JQL view

Using a combination of the ListView and advanced JQL, we can identify the ID of a custom field that's listed on the results.
(info) This option does not require Jira Admin rights.

  1. Create a simple JQL to return an issue that had the field that you want.
  2. After running this query, switch to the "List View" if not already.
  3. Add the field you want as a column in the results.
  4. Click on the name of the field in the column to order the results by this custom field.
  5. Now switch the JQL type to Advanced if not already.
  6. The ID of the field will be listed in the ORDER BY clause.

Using Jira Home Directory and DB Browser plugin

This step is only available in our Server and Data Center products.

  1. To run the following steps, make sure you have the JIRA Administrator's permission.
  2. Install Jira Home Directory And DB Browser.  
  3. Navigate to the Db Console.

  4. Select the customfield table and Execute.

Using URL

Please note, that the "Administer Jira" Global permission is necessary to complete these steps.

  1. Navigate to Settings () > Issues > Custom fields under the Fields section
  2. Click on the More () icon to the right of the custom field you are obtaining the ID
  3. Select the View field information option
  4. 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

オプション 1:

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.

The URL which you can paste on your browser and replace the <JIRA_BASE_URL> is:

  • <JIRA_BASE_URL>/rest/api/latest/field 

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
    }
}

オプション 2:

Using the Get Issue REST API endpoint to fetch details for a specific issue, you can add the ?expand=names parameter so it lists all custom field names that are in scope for it. For example, using issue BS-1:

  • <JIRA_BASE_URL>/rest/api/latest/issue/BS-1?expand=names 

In the last section of the output you can search for the field and take note of the ID in front of "customfield_XXXXX" (here you can see Sprint custom field has ID 10105 and Story Points is 10106):

names: {
...
customfield_10105: "Sprint",
customfield_10106: "Story Points",
...
}

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.

  1. Open up the issue that you want to get the custom field ID for
  2. Click the Actions () icon towards the top right corner
  3. Select the Export to XML option, which will open up a new tab with the issue details in XML format
  4. Search for the field name to identify its 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=#
最終更新日 2022 年 11 月 24 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.