Custom Field Name in Jira JSON

Graeme Mitchell June 16, 2013

I'm trying to integrate Jira with an internal application in our company. I'm utilising the rest API to create a Jira issue via a rest service call:-

https://docs.atlassian.com/jira/REST/latest/#idp1288624

This works, but the problem I have is that I have customfields on my Jira issue that I'd like to populate with data from the third party application in the rest service call. I am aware that you can reference these fields in the JSON in the following way:-

customfield_[custom field_id]

The problem I have is that we have a test Jira instance and a production jira instance. Because the custom field id is system generated, I cannot guarantee the field ID will be the same in test and production, and therefore cannot guarantee what the field name will be in the JSON. It will likely be different between instances. My question then:-

1. Is there anyway to reference the custom field using the name rather than ID, then I can just keep the name consistent between environments

2. Is there anyway to easily control how the custom field ID gets generated via the GUI, without mucking around in the backend DB?

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Aleksander Mierzwicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2013

You can use the /rest/api/2/issue/createmeta with expand=projects.issuetypes.fields, to find custom field ID.

bischi602 September 11, 2016

Can you please give me an example. I have a the field customfield_10000 and I want to get the value of that. How can I access this field with createmeta? Thanks a lot!

Saurabh Gupta December 19, 2018

When you are using above rest call, add that as another query param

Like Andy likes this
1 vote
rickbeerendonk November 27, 2014

You can use the /rest/api/2/field to get the name ("Sprint") of an id ("customfield_10007"): https://docs.atlassian.com/jira/REST/latest/#d2e903

0 votes
Andriy Yakovlev _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 25, 2016

Hey Graeme,

I've created a feature request for you within our public issue tracker, please have a look at it:
https://jira.atlassian.com/browse/JRA-62343

Please comment and watch the case so that your opinion on this issue may be heard.

Cheers

0 votes
Timothy
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.
June 16, 2013

1. Is there anyway to reference the custom field using the name rather than ID, then I can just keep the name consistent between environments

You can use this REST api to call out the fields in JIRA (https://docs.atlassian.com/jira/REST/latest/#idp2013120). Or you can create a mapping of some sorts.

2. Is there anyway to easily control how the custom field ID gets generated via the GUI, without mucking around in the backend DB?

Nope. It's auto generate based on the running number in a database table.

Graeme Mitchell June 16, 2013

Thanks, I was initially going down the mapping route in the calling application if my first question wasn't possible. I might utilise the custom fields service, but it means calling and handling an service. Not ideal, it would nice if the app would support named fields instead rather than relying on a system generated ID you have no control of.

Like Brandon Bernard likes this

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events