Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA API: Could not create an issue with default value "None" in required field.

Evgeniya Shchepina
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 17, 2022

I have a JIRA project with issues which have a custom field "customfield_10101". This field shows up in JIRA UI as 'Platform'.

The field has values 'None', 'iOS', 'Android' etc. 'None' is default value. It looks like this when I want to create an issue in UI:

Снимок экрана 2022-04-17 в 18.46.20.png

 

I want to create an issue using JIRA API trying to fill this field like this: 

{"customfield_10101": {"value": "None"}}

It doesn't work. I've got an error "'{"errorMessages":[],"errors":{"customfield_10101":"Could not find valid \'id\' or \'value\' in the Parent Option object."}}'".

None, "null", null, -1, "" doesn't work either.

I've tried not to pass this field at all and got an error "Platform filed is required.".

 

How I can pass this None default value?

1 answer

1 vote
Nic Brough -Adaptavist-
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.
April 17, 2022

Welcome to the Atlassian Community!

>The field has values 'None', 'iOS', 'Android' etc.

Actually, no it does not have a value "none" - that's what Jira displays to represent the option for "don't set anything in this select list field".  IT's displaying text for the humans, as a blank line is easy to miss.

It's not the default value for the field either, it's the current value (not set). 

The API won't let you create the issue with the field set to "none" (meaning empty), you have the field flagged as mandatory in the settings.

You could reconfigure the field to either have an option for "other", or you could set a default value for it.  (If you leave it mandatory and set a default, Jira won't offer the users "none" when they create or edit the field)

Bill Sheboy
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.
April 17, 2022

Hi @Evgeniya Shchepina -- Welcome to the Atlassian Community.

Yes, and to Nic's answer: when you need to clear a field (and it is not required) with that syntax, please try setting it to null with none of the fields/attributes referenced:

"customfield_10101": null

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer