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 Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
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