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
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

221 views 6 0
Join discussion

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