Get the value of a "customfield" on an issue - how?

Dan Hansen June 10, 2022

I am using the datacenter edition of JIRA (8.20.2) and its API and I have a customfield, customfield_10500 that can have one of multiple string values.

My problem is that I need to get the text value of the customfield, but I seem unable to get this information.

I have this data for a specific issue and the "customfield" returns an ID:

Picture.jpg

So I need the value of customfield ID 10620 - in my case it is the team name, e.g. "My Team 1".

It is my understanding that it should be possible to query the customfields by this direct API call:

Picture2.jpg

.. but if I do this, then I get this 404 error:

Picture3.jpg

Can anyone help me solving this problem? :-) I would really hate hardcoding these IDs in my code.

1 answer

1 accepted

0 votes
Answer accepted
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

Hi @Dan Hansen  Welcome to Atlassian Community!

It seems that you are trying to issue data, collecting custom field value of an existing issue. 

Above code is for getting custom field context, one custom field have multiple context, jira admin create separate context for each project in which a custom field is used. This don't give the value of a custom field for an issue. 

 

For getting a value for a custom field for an issue you need to check these links :- 

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-and-restricting-the-issue-fields-returned-in-the-results

 

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-using-post

 

Run GET in post function :-

https://jira.xyz.com/rest/api/2/search?jql=project=ABC&fields=customfield_22050,key'

It gives you value of a particular custom field not all custom fields value filled in an issue.

 

Solution :-

 

Kindly check following link for Advance Roadmap API :- 

https://docs.atlassian.com/portfolio-for-jira-server/REST/2.13.0/teams/

This is Roadmap Team field, that's why not accessible like other Custom Field.

 

Thanks

V.Y

Dan Hansen June 10, 2022

(deleted)

Dan Hansen June 10, 2022

(deleted)

Dan Hansen June 10, 2022

This is the 3rd time I am replying here - it seems my replies are not saved?

This URL, "https://jira.xyz.com/rest/api/latest/search?jql=key=PRO21&fields=customfield_10500,key'" does not give the real value for the customfield - it merely limits the dataset and displays the exact same data (ID only) and does not expand its name value.

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

Try to export the json result in csv file, It should give complete value inserted in a custom field. Let me add leaders to get correct solutions.

@Fabian Lim 

@Fabio Racobaldo _Herzum_ 

@John Funk  

@Bill Sheboy 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

I don't work with APIs much, but can you add .value to the end of the field? 

customfield_10500.value

Like Vikrant Yadav likes this
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

Hi @Dan Hansen ,

thanks @Vikrant Yadav  for involving me in this thread :)

You should use the following rest api https://docs.atlassian.com/software/jira/docs/api/REST/8.22.3/#issue-getIssue that will return a representation of issue in JSON format including all custom fields.

Hope this helps,

Fabio

Like Vikrant Yadav likes this
Dan Hansen June 10, 2022

@John Funk - it looks like this without the value part - the customfield ID is visible but not the value:

Try1.jpg

But with the ".value" in the URL then it removes the customfield:

Try2.jpg

Dan Hansen June 10, 2022

@Fabio Racobaldo _Herzum_ - I am already using this and it shows the output as within my original post. To show the entire thing then it is here (I have cut away some of the unnecessary stuff):

URL which will include all data scope (as I know it at least): https://jira.xy.com/rest/api/latest/issue/KEY-736?expand=renderedFields,names,schema,transitions,operations,editmeta,changelog,versionedRepresentations

If I then search for customfield_10500 then I get these results:

Try1.jpg

Try2.jpg

Try3.jpg

Try4.jpg

Try5.jpg

If I search for the actual team name that I can see is set on the issue, then I find it only visible in the CHANGELOG dataset (because I have tested it with some changes).

So the data seems not visible not even with the complete dataset?

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

@Dan Hansen  Is it a single select list field or single line text field? 

Dan Hansen June 10, 2022

@Vikrant Yadav - it is a single select list. There are several entries in the team list, but you can only select one.

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

Okay , but postman is giving value/option id not exact value/option name, right ? 

Dan Hansen June 10, 2022

@Vikrant Yadav - sorry but I do not know what you mean?

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

@Dan Hansen  I tested in postman following GET command and get custom field value selected for an issue, as you can see in the screenshot. I think you are looking for the same.   

You can convert json result in csv or excel to see correct format or use Power query to fetch data in excel directly from jira. 

https://jira.xyz.com/rest/api/2/search?jql=key=HBBPD-934&fields=customfield_36066,value' 

 

Custom field value.PNG

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2022

@Dan Hansen  As per the screenshots shared by you and after checking the field type ( com.atlassian.teams:rm-teams-custom-field-teams ) , it seems that it's Advanced Roadmap "Team" field. Please correct me if I am wrong. 

If it's Roadmap "Team" field, kindly check workaround shared in following link :-  I would like to have a rest API call that returns the issues' details with their respective Portfolio Teams name. 

 

Thanks

Dan Hansen June 12, 2022

@Vikrant Yadav - yes, good spotted that we are using the JIRA Advanced Roadmap feature. I did not know the Team customfield was special for this?

The workaround does not help me much as I do not have access to the database - only via the standard API interface we have.

Also if I run the same query/URL as you have then it will still not show the value - only the ID:

Pic1.jpg

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 13, 2022

@Dan Hansen  I don’t think Roadmap Teams field is accessible via REST API.

@Fabio Racobaldo _Herzum_  Kindly suggest 

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 13, 2022

Hi @Dan Hansen  Kindly check following link for Advance Roadmap API :- 

https://docs.atlassian.com/portfolio-for-jira-server/REST/2.13.0/teams/

This is Roadmap Team field, that's why not accessible like other Custom Field.

Thanks

V.Y

Dan Hansen June 13, 2022

@Vikrant Yadav - great and this works (the blurred part is the actual team name)! :-)

Pic2.jpg

If you don't mind creating your comment as an answer, then I will accept this as the answer.

I don't understand why this information is not available within the normal(?) data, but I assume it has something to do with this Roadmap functionality has been purchased and then not yet a fully integrated part of the native API.

Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 13, 2022

Cool! Glad to hear it works for you :)

I have added solution in my first comment, you can mark that as answer. 

Suggest an answer

Log in or Sign up to answer