ScriptRunner Behaviour how to update value of custom field type checkbox

Hello Community,

I am trying to update the value of a custom field of type checkbox.

My usecase:

Every Epic has a custom field of type checkbox known as "Dev Reviewed" I want it so that once a user updates the value of "Dev Reviewed" in an Epic then it flows down and does the same for all the stories under that Epic. That way the user doesnt have to click on every individual Story and update it that way. 

I am utilizing a Behaviour that looks when the Custom Field "Dev Reviewed" is updated in an Epic and runs the following code:

//Utilize JQL to get all the issues under an Epic
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def query = jqlQueryParser.parseQuery("'Epic Link' = "+currentIssue)
def results =, user, PagerFilter.getUnlimitedFilter())

//Loop through all the Issues returned and modifies their custom field value type checkbox to "Yes"
results.getIssues().each { documentIssue ->

IssueService issueService = ComponentAccessor.getComponent(IssueService);
def optionsManager = ComponentAccessor.getComponent(OptionsManager);
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()

Issue issue = issueService.getIssue(user, documentIssue.getKey())?.issue

CustomField customField = customFieldManager.getCustomFieldObjectByName("Dev Reviewed")

Options options = optionsManager.getOptions(customField.getConfigurationSchemes().first().getOneAndOnlyConfig());

def selectedOptions = options.findAll {
it.value == "Yes"
}.collect {
issueInputParameters.addCustomFieldValue(, *selectedOptions)

def update = issueService.validateUpdate(user,, issueInputParameters)
if (update.isValid()) {
issueService.update(user, update)


The code inside the loop i found from another post in the community.

I am unsure how it works and have not got it to work for custom field. My custom field of type checkbox has only one value "Yes".

I managed to get this code to work when it comes to updating the out-of-the-box field Summary, but not for any custom fields.

Could someone point me to the right direction regarding this.

It is worth noting that I tested out the code and I am succesfully able to get my custom field, find the value inside, but not change it.

Furthermore, could someone explain how "options" work and how I can set the value of a checkbox custom field. selectedOptions is also very confusing to me. Could not find good documentation online for this.

Thank you!!!


1 answer

1 accepted

0 votes
Answer accepted

Hello Community,

I figured this out myself.

issueInputParameter takes two arguments, the id of the custom field you want modified and the id of the Options value you want.

Changed my code to the following and it worked:

*selectedOptions to "14192"

14192 = the id for value "Yes" in my custom Field.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


244 views 0 6
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