Forums

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

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

flaimo
Contributor
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
Contributor
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
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events