Removing value from a group picker field
Asked by Ivan D:

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.


Answers:
author: Darryl Lee
body: 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.

comments: author: Ivan D
body: Hi [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322)

Thanks a ton, it works!

Just wondering why Atlassian doesn't put a couple of examples in the automation guide for such ambiguous cases.


author: Fazila Ashraf
body: [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) , you saved a lot of my time today! Thank you!


author: Darryl Lee
body: 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-->

comments: author: Bill Sheboy
body: Hi there!

[@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) If I remove the spacing from your suggestion it is identical to what [@Ivan D](/t5/user/viewprofilepage/user-id/3984585) posted. Are you noting this is a spacing issue? Thanks!

[@Ivan D](/t5/user/viewprofilepage/user-id/3984585) 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


author: Darryl Lee
body: Ah crap, you're completely right [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)! 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.


author: Ivan D
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

It's literal name.