Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,211
Community Members
 
Community Events
176
Community Groups

Removing value from a group picker field

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.

2 answers

1 accepted

3 votes
Answer accepted
Darryl Lee Community Leader Aug 05, 2021

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.

Like Bill Sheboy likes this
0 votes
Darryl Lee Community Leader Aug 05, 2021

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-- 

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

Darryl Lee Community Leader Aug 05, 2021

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.

Hi @Bill Sheboy 

It's literal name.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events