Customfield cannot be set

Hello,

I’m trying to create issue via REST with some customtype field set, but it returns me a bad request with response: customfield cannot be set. It is not on the appropriate screen, or unknown. My customtype field is associated with ‘Default screen’, so in my opinion this error shouldn’t occur.
Is it JIRA side problem? Why am I getting this error?

Thank you,
Jacek

It means what it says. Either the field does not exist, or the field is not on the screen that the issue you are trying to create uses for “create issue”.

You can test this quite easily in a browser - click create and see what it offers you. When you select the project and issue type, you’ll find your custom field is not there.

The reasons are:

  • Create is set up to use a screen that does not include your field
  • The field configuration hides the issue
  • The field does not have context for this project and issue type

The “where’s my field” function will tell you why the field is not there as well.

2 Likes

Thank you @nic for your reply.
I found out that my field requires being associated with ‘PROJECT_KEY: Scrum Default Screen Scheme (7)’ screen scheme, my problem is that I need to do it programmatically via REST API.

I know the key of project and id of custom field but I’m not sure about which endpoint I should use. There is an endpoint for adding fields to screen POST /rest/api/2/screens/{screenId}/tabs/{tabId}/fields but it requires screenId and tabId, which I don’t know where to find.
Do you know a solution for this problem?

Thanks for your help,
Jacek

The IDs are shown in the admin urls when you go to amend them.

This answer won’t solve my problem because I’m developing Jira addon and I’d like to not ask the end user to give me screenId and tabId :wink: Is there any other way to get those ids? I believe that Atlassian wouldn’t give only possibility of creating custom fields but no option to set them.

You can’t “set” something if you don’t know what it is. But, yes, have a look at JIRA 7.6.1 - you’ll find you can “get” information about screens and fields over REST there.

@nic this is a JIRA Cloud topic - the REST APIs are here: https://docs.atlassian.com/jira/REST/cloud/

The APIs for workflows and fields are not complete @jjusianiec, so you believe incorrectly - Atlassian do not yet provide a way to modify custom field values and screens etc via the REST API. It is in their road map to change this.

1 Like

@jbevan thank you for your help anyway. I’m disappointed because it’s the second time that I get caught in the Atlassian REST API trap, see my other topic. Atlassian you should add a warning to your JIRA Cloud REST API documentation that there is no point of creating custom fields, this type of information would save me a lot of time and effort.

2 Likes

@jbevan this is frustrating indeed! Putting aside what set of API is available and which is not at any given point in time I expect that what is available is simply consistent. Otherwise the API misses the feel of internal integrity… It is not consistent at the moment with API for adding custom fields available and manipulating custom fields not available.

@nic Is there any chance that the id of Scrum Default Screen Scheme will be the same among JIRA installations? After all it is pre-defined dialog that comes with JIRA by default.

Apologies for posting the wrong REST API docs, thanks @jbevan for correcting me!

@piotr - no, you can’t assume that the id will be the same across systems. It will be on a fresh installation, so if someone installs several JIRA Software systems in places, they will have the same set of ids for the default schemes. But if someone installs JIRA Core, then creates some schemes, and then adds Software, the default scheme IDs could well be different.

So @nic, @jbevan I am confused now - are you saying that in general addons cannot manipulate values of fields disregarding whether these fields are native or custom? I am pretty sure it is not the case.

No, that was not clear, sorry. You can edit the content of fields by using the calls that update issues. There are not yet any methods for manipulating the screens and fields. The REST API allows most of the actions a normal user can do, but does not do much of what an administrator can.

1 Like

We decided to use https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue with the flag overrideEditableFlag set to true. There was no other way to set the custom field… Using this flag requires the highest addon permissions which is limiting the audience of our addon…

1 Like

Thanks for all the posts here all. Is it possible to skip this screen check on API calls to create an issue? I.e. the POST /rest/api/2/issue ?

What I want to do is clone an issue by getting and then setting the values of all the fields in a new … and it is a real problem if the fields need to be manually added (even if by the API) to the screens, esp if the issues will be created on variable projects.