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

flaimo March 5, 2016

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

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2016
flaimo March 6, 2016

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

1 vote
Michael Partyka
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2016

Suggest an answer

Log in or Sign up to answer