Next-gen: Cannot create issue with a custom field through API.

EP December 31, 2019

I'm sending a POST request to  /rest/api/2/issue endpoint.

I can create an issue without the custom field just fine but when I add the custom field it complains:

"custom_field_name": "Field 'custom_field_name' cannot be set. It is not on the appropriate screen, or unknown."

I've added this field using GUI in project settings. Please let me know how can I "add it to the appropriate screen".

 

Best & Happy New Year!

EP

2 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 1, 2020

It looks like you have literally copied "custom_field_name" into your code, rather than replacing it with the name of the custom field you are trying to set.

To check the Jira side of this, log in as the same person as is used in your script, click "create" and check the names of the fields that are shown to you.  The REST API respects what is set for interactive users.

EP January 2, 2020

Thanks for your response. I used the correct field name ( I put custom_field_name here to make it easier to understand that I was referring to my custom field).

So when I login interactively I see the same name I use through my API (the real name is reporter_email) see image attached.

image.png

 

And the exact error I get is:

{
"errorMessages": [],
"errors": {
"reporter_email": "Field 'reporter_email' cannot be set. It is not on the appropriate screen, or unknown."
}
}

 

EP January 2, 2020

EDIT: I posted my reply twice because Jira did not show it at first.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 3, 2020

Hmm.  Could you try replacing your field name with the customfield id?  I.e.   "customfield_12345"?

EP January 6, 2020

Thanks, this really helped. Now it works.

(I found the id by inspecting the element when I was editing the form).

0 votes
Warren
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.
January 2, 2020

Hi @EP 

That field needs to appear on the equivalent of one of the Edit screens in the "old UI view" - if it isn't there, you won't be able to set the field value through the API

EP January 3, 2020

How do I access the "old UI view"?

EP January 3, 2020

PS. I'm on a next-gen project.

Warren
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.
January 3, 2020

Hi @EP 

Sorry I missed the Next Gen part - I don't think my comment is appropriate then, please ignore

Suggest an answer

Log in or Sign up to answer