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?
Community moderators have prevented the ability to post new answers.
You can use the /rest/api/2/issue/createmeta with expand=projects.issuetypes.fields, to find custom field ID.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you are using above rest call, add that as another query param
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.