Rename custom field id

aldokhayel May 14, 2020

Hello,

I use rest API (/rest/api/2/issue/IssueKey) to fetch issues from Jira like the following example:

problem:

 "key": "FF-120",
"fields": {
"resolution": "Pending",
"customfield_11792": "Need review",
}

I define the custom field name as  "current phase", but when I fetch it using API,  the key (id) of the custom field appear as customfield_xxxxx NOT "current phase", how to fix it?

I need to be like that:

 "key": "FF-120",
"fields": {
"resolution": "Pending",
"current phase": "Need review",
}

This is an example, and I have many custom fields.

Kindly I'm looking for your support.

2 answers

0 votes
David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2020

There is nothing to 'fix'. The REST API is working exactly as it should.

The ID for custom fields is always in the format "customfield_xxxxx", not plain words, like the built-in fields.

aldokhayel May 18, 2020

Many thanks for your response.

But in case using issue rest API. I just received customfield_xxxxx without any meaning instead of using a key name for example: current phase.

Based on your experience how do you deal with this situation? and Is there a walkaround?

David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2020

Sorry, but I still don't quite understand what you're asking for. Every field has the characteristics ID and Name:

  1. The ID for custom fields is in the format "customfield_xxxxx". You cannot change this as it's assigned by Jira when the field is created..
  2. The Name for custom fields is 'plain words', like "My custom field". You change this to whatever you want it to be, whenever you want.

Your query to /rest/api/2/field returned exactly what it was supposed to.... information about a custom field with the ID "customfield_11792" that has the Name "current phase". The field's Name is right there.

I get a feeling you want the IDs of custom fields to come back in the same way as Jira's built-in fields, such as the built-in field that has the Name "Issue Type" and has the ID "issuetype" . That's not possible; Jira's built-in fields are the only ones that have 'plain words' as IDs

If you're asking for how to 'fix' Jira by adding an new attribute called 'custom' with a true / false value for every single field, then that's a feature request you'll have to make to Atlassian. Personally, I think they'll say much like I have... if you want to know if a field is a built-in one or a custom one, just look at the ID; if the ID starts with "customfield_" then you know it's a custom field.

0 votes
aldokhayel May 14, 2020

When I investigate in the custom fields API (/rest/api/2/field), I found in the following:

Current:

{
"id": "customfield_11792",
"name": "current phase",
......
],

I need to be like that to be fixed when I fetch the issues using rest API

{
"id": "current phase",
"name": "current phase",
"custom": true,
]

Any ideas on how to fix it?

Suggest an answer

Log in or Sign up to answer