How to set form value for checkbox field with Scriptrunner/Behaviour

I have implemented a custom field with two checkboxes in JIRA. Now I would like to use a behaviour to set some of the checkboxes to true when an issue is created. How des the script have to look like? The documentation under the script field only shows an example for a string value, but not for checkboxes.

I tried something like this, which didn't work:

import com.atlassian.jira.ComponentManager
import com.onresolve.jira.groovy.user.FormField
import org.apache.log4j.Category

//if (!underlyingIssue?.created) {  
 FormField target_audience = getFieldById("customfield_11335")
 target_audience.setFormValue(["Checkbox A":"Yes"]) // "Checkbox A"
 //target_audience.setFormValue([10719]) // "Checkbox B"
//}

 

 

 

 

2 answers

1 accepted

thank you. this worked. didn't think that setting those values is a bit more complicated than in php smile

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,147 views 6 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot