The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Automation to update custom field with checkboxes

Kenneth Robinson
May 17, 2023

I am trying to use the automation to update a custom field that is a checkbox of various options.

The goal in the end is that the custom field may have both options selected

I found the custom field ID from the URL, which is 12500

/secure/admin/EditCustomField!default.jspa?id=12500

When I edit the various options (use blue and green as their option names) as an example, I have the following URLs

t/secure/admin/EditCustomFieldOptions!edit.jspa?fieldConfigId=17069&atl_token=B...5fc_lin&selectedValue=12012
t/secure/admin/EditCustomFieldOptions!edit.jspa?fieldConfigId=17069&atl_token=B...5fc_lin&selectedValue=12013

 

I am assuming that 12013/12012 are the ID for each of the options 

 

When I tire either on of the JSON structures below, the automation returns that the value is not found


{
"update": {
"customfield_12500": [{
"add": {{ "value": "blue" }}
}]
}
}


OR


{
"update": {
"customfield_12500": [{
"add": {{ "id": 12013 }}
}]
}
}

 

In the automation script:

it will look for "blue" in the summary or description, then add blue to the custom field.

it will also look for "green" in the summary or description, then add green to the custom field.

If both blue and green are present then the customfield needs to have BOTH values.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Trudy P Claspill
Community Champion
May 17, 2023

Try this.

To set one checkbox value

{
"fields": {
"customfield_12500" : [{ "value" : "blue"}]
}
}

 

To set multiple checkbox values

{
"fields": {
"customfield_12500" : [{ "value" : "blue"}, { "value" : "green"}]
}
}
Kenneth Robinson
May 25, 2023

Those don't "add" the values to the custom field

I have a two simple if statements

if summary contains blue
then customfield = blue

if summary contains green
then customfield = green

if the summary contains both blue AND green then the customfield should be `blue` and `green`. However, it will only be `green`

 

It seems like the customfield is being overwritten instead of appended.

Trudy P Claspill
Community Champion
May 25, 2023

As I understand it ithe statement will set only the check box values you specify and clear the rest. So if you want to set multiple check boxes you need to use the statement for setting multiple values in a single statement.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events