Hi,
I want to add a New Field Value to Multi-Select in Issue Update thru REST API. While Passing the New Value to the JIRA Update I am getting an error. I am not sure how to add the new value to Multi-select. Any other suggestions will be helpful.
Input:
{
"fields" : {
"customfield_12354" : [
{
"value" : "New Jira Test Account"
}
],
"project" : {
"id" : "11000",
"key" : "TP"
}
},
"issueIdOrKey" : "86758"
}
JIRA Output:
{
"errorMessages": [],
"errors": {
"customfield_12354": "Option value 'New Jira Test Account' is not valid"
}
}
Thanks,
Nagendra M
Hi,
If I understand your question here, you are trying to create a new value for a multi-select field, assign that value to a specific Jira issue in a single REST API call.
You can not do this action in a single REST API call. Which might explain why you are getting this error. When you edit an issue in Jira via REST, you are only able to select from the current possible values that have been preset for that field. For multi-select fields, their values have to be defined before any issue in Jira can actually utilize that value. (The same is not true for the labels type field, but this is not the same kind of field).
The other problem here is that for user created custom fields in Jira Cloud, the REST API currently won't let you edit the field option values. There are a pair of feature requests for this functionality via REST API in
There is an endpoint that could do this in POST /rest/api/2/field/{fieldKey}/option. However this endpoint can only be used by connect apps (aka plugins or apps) that create custom fields. From that document:
Note that this operation cannot be used with the built-in custom fields. It only works with issue fields added by Connect apps, as described above.
So if you're creating a connect app that in turn creates a custom field, then you could use that endpoint to add options to a multi-select type custom field. However if that custom field is not created by a connect app, there does not appear to be a way to change those options/values via REST at this time. Instead you would need to do this via the web interface of Jira.
Once those options exist for those fields, then you can use the Edit issue endpoint in PUT /rest/api/2/issue/{issueIdOrKey}. Which can then set/change the custom field value on that issue from the available options.
I hope this helps.
Andy
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Andy Heinzer ,
first, thanks for the detailed reply.
Two years ago I had to create an app that would create a custom field, so that I could manage the options through the REST API.
Now I'm in the same situation, but after checking the Docs I have found a new group of endpoints that apparently work for custom fields created in Jira (no need to create an app):
https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-group-Issue-custom-field-options
Is this something new? Or am I missing something?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jordi Fontseca ,
We have added endpoints to:
However, the feature requests are still open since we still miss the endpoints to edit/delete custom fields and to delete custom fields options. Keep following them for updates.
I hope this explains.
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dario B !
I see, thanks for the information!
Btw, I have already started using the GET/PUT/POST methods for the custom field options and it's very useful.
I have only encountered one issue: right now, it seems that it's not possible to add new "cascading options" to existing options (for Cascading Select fields).
So I can create an option with two suboptions like this:
POST /rest/api/3/customField/{fieldId}/option
[{"value":"Option A","cascadingOptions":["Suboption 1","Suboption 2"]}]
But later I can NOT add a new suboption to it:
POST /rest/api/3/customField/{fieldId}/option
[{"value":"Option A","cascadingOptions":["Suboption 3"]}]
There is no error, but the request is ignored.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jordi Fontseca ,
I believe that after the options are created (sending a POST request), you should send a PUT request to update the field instead of sending another POST request.
However, please notice that sending a PUT request to edit the field options is marked as experimental and, as mentioned:
Experimental features
Features and methods marked as experimental may change without notice. Feedback on experimental functionality is welcome. Report your suggestions and bugs in the ACJIRA project (preferred) or use the Give docs feedback link at the top of this page.
Can you kindly test this and let me know if it works?
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Dario B !
I also tried sending a PUT request.
This works for changing an existing value (for instance, replacing "Suboption 2" with "Suboption 2 Renamed"):
PUT /rest/api/3/customField/{fieldId}/option
[{"value":"Option A","newValue":"Option A Renamed","cascadingOptions":[
{"value":"Suboption 2","newValue":"Suboption 2 Renamed"}
]}]
But it does not allow adding new values (if I provide a "Suboption 3", it is ignored):
PUT /rest/api/3/customField/{fieldId}/option
[{"value":"Option A","newValue":"Option A","cascadingOptions":[
{"value":"Suboption 3","newValue":"Suboption 3"}
]}]
I have already submitted this to Atlassian Support and they have raised it as a bug here:
https://ecosystem.atlassian.net/browse/ACJIRA-2058
Hopefully it will be fixed soon
Thanks again for the feedback!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jordi,
You are very welcome and thanks for providing an update on this!
Have a nice weekend!
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there any way to do that in Jira Server? I dont see that api available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Dario B ,
same question as above. Is there similar end points for jira server?
or any other work around? I know of few like using selenium with python or like using interceptor on chrome with postman and it works. But i was looking for any stable/sustainable work around if possible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Allen Culpepperand @sujoychakraborty93
your (sub-)question is about Server and until now not answered, so I dare to ...
You currently can't add custom field values with the standard Server REST API, so you have some options:
Note: I belong to the vendor's support of the 'REST Extender'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
there is also a Jira cloud App called "External Data for Jira Fields" that allows you to synchronise an external data source into field options of native custom fields.
You could connect a custom field with an external API or with a simple Json file. From then on the options will stay in sync (new values added and missing values disabled) so it always reflects your data source.
Maybe this gets you around creating your own connect-app.
Thomas
Disclaimer: I am the product manager of said App.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.