Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add more values to the custom field without overwrite previous value?

Sinisa Glusac
Contributor
August 11, 2022

Hi all, 

I have a specific task to do. I have to create an automation for multiple squads and when each squad chooses the option "approved", the squad name should appear in another field. I did it for one squad and it was working perfectly. See attached picture. 

 

Screenshot 2022-08-11 122917.pngBut when I tried to add another team, the first team name in the field was replaced with the second one instead of keeping both names. See attached picture. 

Screenshot 2022-08-11 123818.png

More names can be added to the field manually, so this is not a field limitation. 

I was experimenting with different custom fields (currently I use the custom field "select list - multiple choices) but without success. Then I tried to experiment with advanced field editing with JSON. But I'm still new in Jira and not that experienced, so I need help. I found something that could work for my case but after many tries didn't work at all.

https://community.atlassian.com/t5/Jira-Software-questions/Automation-Advanced-field-editing-JSON-add-multiselect-values/qaq-p/1934405#U2104772 

Also, you can see my automation here

Screenshot 2022-08-11 124833.png

As well as my audit log error

Screenshot 2022-08-11 124942.png

 

Please advise and if you need more information, I would be very happy to provide. Thank you very much. 

BR, 

Sinisa

1 answer

1 accepted

0 votes
Answer accepted
John Funk
Community Champion
August 11, 2022

Hi Sinisa,

Not sure why you would need to use #lookupIssues. What if you just did this:

{

      "update": {

        "customfield_10155": [{

                "add": "Navy"

        }]

}

Sinisa Glusac
Contributor
August 14, 2022

Hi John, 

 

I really appreciate your suggestion. I've tried and it didn't work, unfortunately, here is the

audit log error 

Screenshot 2022-08-14 153951.png

John Funk
Community Champion
August 15, 2022

Ah, looks like I missed one more curly bracket at the very end when I cut and pasted. Ad one more } and a new last line or one beside the very last one and give that a whirl. 

Sinisa Glusac
Contributor
August 15, 2022

Like this maybe? didn't work either

 

{

"update": {

"customfield_10155": [{

"add": "Navy"

}]

}}

John Funk
Community Champion
August 15, 2022

Same error? 

Sinisa Glusac
Contributor
August 15, 2022

Yes, this is the error

Screenshot 2022-08-15 165234.png

John Funk
Community Champion
August 15, 2022

Okay, that's a different error. What exact type of field is customfield_10155?

Sinisa Glusac
Contributor
August 15, 2022

A field for multiple choices

John Funk
Community Champion
August 15, 2022

But can you tell me the exact type that Jira calls it? 

Sinisa Glusac
Contributor
August 15, 2022

Maybe this will help because I don't know the exact name

Screenshot 2022-08-15 170103.png

John Funk
Community Champion
August 16, 2022

Let's try this:

{
"update": {
"customfield_10155" : [
{
"add": {
"value":"Navy"
}
}
]
}
}

Like # people like this
Sinisa Glusac
Contributor
August 17, 2022

Hi John, thank you very much, I just tested it and it works perfectly!!! I really appreciated your help, you made my day! 

 

Cheers, 

Sinisa

Like John Funk likes this
John Funk
Community Champion
August 17, 2022

Great! I am glad that worked, and it helped you out.  :-)

Like Sinisa Glusac likes this
Sinisa Glusac
Contributor
August 18, 2022

It helped a lot, later I was using the same JSON but for different reasons, and slightly modified. For instance, if some squad later chooses instead of "Approved" something else, such as "Not required" or "To be clarified" then the name of the squad has been removed from the field. So I used this:

{
"update": {
"customfield_10155" : [
{
"remove": {
"value":"Navy"
}
}
]
}
}

(remove instead of add) and also works perfectly!

So once again, thank you very much for this brilliant work. 

Like John Funk likes this
John Funk
Community Champion
August 18, 2022

Great! Glad it is working for you!

Like Sinisa Glusac likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events