Hello,
I need to remove a value from a group picker (multiple values) field "customfield_11111". Using the following format for Additional fields in Edit action:
{
"update": {
"customfield_11111": [
{
"remove": {
"value":"group_name"
}
}
]
}
}
I get this error:
Error editing issues AC-4520 (Operation value must be an array of group objects (customfield_11111)).
Appreciate any idea how to make it working.
Whoops, ok, here's the fix:
{
"update": {
"customfield_11111": [{ "remove": { "name":"group_name" } }]
}
}
The trick was changing from value to name. The clue was here:
REMOVE: Removes an element from a field that is an array. The incoming value must be the same shape as the items of the array in a GET (although you can remove parts of the object that are not needed to uniquely identify the object).
What I did was look at the JSON of an issue:
https://MYSITE.atlassian.net/rest/api/latest/issue/HELP-20
And therein I saw:
"customfield_10097": [
{
"name": "jira-software-users",
"self": "https://MYSITE.atlassian.net/rest/api/2/group?groupname=jira-software-users"
},
{
"name": "shift2",
"self": "https://MYSITE.atlassian.net/rest/api/2/group?groupname=shift2"
},
{
"name": "shift3",
"self": "https://MYSITE.atlassian.net/rest/api/2/group?groupname=shift3"
}
]
So then, when you remove an object, it has to match. So name, not value. But as the docs state, you don't need self, since name is unique enough.
Hi @Darryl Lee
Thanks a ton, it works!
Just wondering why Atlassian doesn't put a couple of examples in the automation guide for such ambiguous cases.
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.
I've yet to test this, but I think this is right:
{
"update": {
"customfield_11111": [{ "remove": { "value":"group_name" } }]
}
}
I used this for reference: https://developer.atlassian.com/server/jira/platform/updating-an-issue-via-the-jira-rest-apis-6848604/#operation--verb--based-update--explicit-verb-via--update--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there!
@Darryl Lee If I remove the spacing from your suggestion it is identical to what @Ivan D posted. Are you noting this is a spacing issue? Thanks!
@Ivan D You are showing a literal value for "group_name". Is it indeed a literal value or is it a smart value, such as "{{issue.someField}}"?
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah crap, you're completely right @Bill Sheboy! I at first added some extra brackets, then double-checked the docs and came up with my code which yup, is exactly the same. :-/
The other thing I was wondering is if group objects need to be referenced by ID (a la users) instead of names.
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.
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.