Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello,
I am trying to create a multi-select custom field with options like test1,test2,test3 using rest-API in Jira server 8.4.
Using https://jira.com/rest/api/2/field
raw(JSON)
{
"name"
:
"ReTest field"
,
"description"
:
"Custom field for testing"
,
"type"
:
"com.atlassian.jira.plugin.system.customfieldtypes:multiselect"
,
"searcherKey"
:
"com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher"
}
But there is no options in it.
Please help me to create with options using rest api.
Thank you
Fayaz
Not sure if this would help you now. Might help someone else!
There's a work-around that solved this issue.
1) Create the custom field using POST /rest/api/2/field and body json as you do.
2) After the custom field is created (it'll be created without options), you can POST to /rest/globalconfig/1/customfieldoptions/{custom_field_id} with the body json as below:
[{"name":"option1"}, {"name":"option2"}]
Hi Surya, this was helpful but didn't actually work on the later versions of Data Center, due to a missing tag. You need to prefix the body JSON options list with a literal "options" tag, viz:
"options":[{"name","option1"}, {"name", "option2"}, ...]
It took me a lot of searching to find this, and the idea of adding the tag sprang from someone's implementation of this against the new version of Cloud REST API. But I can confirm that it works on Data Center.
Also note that you must append "setOptions" to the URL command. Viz:
rest/globalconfig/1/customfieldoptions/{custom field id}/setOptions
So the curl command to set the options of an existing custom select field would go like this:
curl -D- -u "<username:pwd>" -X POST -H "Content-Type: application/json" -H "X-Atlassian-Token: nocheck" http://<your_host_baseurl>/rest/globalconfig/1/customfieldoptions/{customfield_nnn}/setOptions?os_AuthType=basic -d '{"options":[{"name":"option1"},{"name":"option2"}]}'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @john_cougar
Thanks for posting this update!
When Jira 10 was released, this broke our test generation and now I finally stumbled over your update which got things working again!
Thanks,
Fredrik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I think that's not possible at the moment. I found this related ticket about the issue:
https://jira.atlassian.com/browse/JRASERVER-36112
It's still in gathering interest status. Although you can check out plugins for this issue like:
https://marketplace.atlassian.com/apps/1217643/extender-for-jira?hosting=server&tab=overview
Regards.
Elifcan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elifcan, It is possible, I have just tested it on Data Center, and there is a fair bit of stuff like this for Cloud. I confess it did take some digging, and I was almost discouraged by the claim that using the path:
/rest/globalconfig/1/customfieldoptions/{custom_field_id}/setOptions
... is unsupported, but it does work for me. I'm still checking to see if there's a way to ADD additional options without wiping out the original ones but getting closer!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.