How do I add value to a multiselect property using Automation for JIRA.
Setting an initial value using JSON is easy and works:
{"fields": {"Revenue Groups": [{ "value" : "Rev. Group 1"}]}
Adding an extra is a lot harder. I've tried the following (and other solutions) but without success.
{ "fields": {"Revenue Groups": [{ "value" : "Rev. Group 2"}, {{issue.customfield_13100.asJsonObjectArray("value ")}}]
}
}
Hello Andre,
I was able to get mine work by adding the following to the Advanced Edit section of the automation. In my case, I had a multi select (customfield_10037) with values, 1,2,3,4,5,6.
{
"update": {
"customfield_10037" : [
{
"add": {
"value":"2"
}
}
]
}
}
Hi Kian,
Thanks a lot. Works like breeze......
I've an additional question. Where can I find documentation on the operations 'add', 'remove' and 'set'. I'm wondering if there are more options. Starting from the following URL (https://confluence.atlassian.com/automation/advanced-field-editing-993924663.html) I can find a lot info but nothing related to operations as mentioned.
Cheers,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kian Stack Mumo Systems
Hi Kian, does this work with insight multiple custom fields?
I am trying to use automation to add insight values to an insight custom field that is configured to be multiple.
I added:
{
"update": {
"customfield_32970" : [
{
"add": {
"key" : "PPBCMDB-275620"
}
}
]
}
}
But I am getting some errors in the automation:
PPBSR-3588 (data was not an array (customfield_32970))
Even though the field is configured to be Multiple
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Claire Berry
Hey Claire,
Did you end up finding a solution to your Insight automation error ?
I am receiving the same error. (data was not an array)
Your post has been the only one I've found attempting this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Zac Boyd @Claire Berry @Elena Lurye
Dear all,
I ran into the same problem when I used the example of Claire in which she used: "add": {"key": ...
So I looked at the example of Kian where he used:
"add": {"value": ...
And that did the trick!!
Although the field may be used as "key"-field, use the (restricted?) word "value" and then it seems to work. It also works with:
"remove": {"value": ...
Kind regards,
Erik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I also eventually got this to work with the below...
{
"update": {
"customfield_12345" : [{"add": [{"key" : "ABC-123"}]}]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kian Stack Mumo Systems Anybody know how to target a customfield drop down value to amend (reset) when needing to change back from an existing value of either "Yes" / "No" back to nothing (blank) i.e None?
Having a value: (blank) or null or none causes an error in the advanced Json, it's a single select custom field or is it about removing the actual value and then it essential has no value?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can't you just do something like the below to clear a value from a single select custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response @Claire Berry but unfortunately I'm having to used the advanced section due to my custom field not even appearing in that list to choose from in the first place. From what I can tell, because it is a required field, it cannot be reverted as it is expecting either value available (Yes / No). It's default is 'None' because it hasn't been selected as a required value yet. This only get's forced on the user when transitioning or amending something else on the ticket. This required field was added after the fact on existing tickets.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Marcel Rossouw is your field a regular since select list or an insight/asset custom field?
I am not sure why the field doesn't show in the drop down for you, that's strange. I can find fields in project automation to clear which are set as required. And I have tested the removal of this as per my screenshot previously and it works.
For single select lists, it looks like the only JSON it supports is 'set'
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#:~:text=For%20example%2C%20to%20set%20the%20Single%20Select%20field%20to%20green%20during%20an%20edit%2C%20you%20can%20use%20the%20following%20JSON%3A
eg. (where 'Read' is an option in the select list to remove):
{
"update": {
"customfield_30904": [
{
"set": {"value": "Read"}
}
]
}
}
This doesn't appear to accept "None" or an empty string ""
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I figured it out. Because it's a required field - it would not allow a value other than one of the requires values (which makes sense). I had to make the field unrequired and then used this in my automation and it worked:
{
"update": {
"customfield_XXXXX": [{"set": {"value": null}}]
}
}
And that removes any predefined value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
null is one thing I didn't try :)
However this still doesn't work for me when I test it.. regardless if the field is required or not.
Maybe we are on different versions and it's available where you are.
Glad you got it sorted though
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To answer you from earlier, the field I'm targeting is a single select value dropdown field. (customfield)
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.