ScriptRunner explain IssueService, Options, and IssueInputParameter Edited

Hello Community,

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

I found code online that allows for this to hapen but I cant get it to work.

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)

Could someone walk me through this code and explain what is happening.

Primarly I am confused with how to set up my issueInputParameter such that it has the value I want for my Custom Field of type checkbox, which is value "Yes". 

Furthermore, I fail to understand what Options are and how I can levarage them to succesfully update a custom field.

Thank you for your time and expertise!


1 answer

1 accepted

Hi Community,

I figured this out myself.

IssueService: Used to update issues correctly

Options: Returns the options available for my customField. I need to get the ID of such options to change a value.

IssueInputParameter: Provide my the custom field I want changed and the ID as a string of the value which I want to change in the custom field

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

146 views 0 4
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