Groovy help!!

Hi All,

I'm trying to upadte slect list custom field while creating an issue - Using below script for this,

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.customfields.manager.OptionsManager

def componentManager = ComponentManager.instance
def optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class)
def customFieldManager = componentManager.getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName("Blocking status")
def fieldConfig = cf.getRelevantConfig(issue)
def option = optionsManager.getOptions(fieldConfig).find {it.value == "Blocked"}
issue.setCustomFieldValue(cf, option)

This code is working in all other places except at creating an issue (eventhough I placed this script in last in order).
Is something I need to change in code for making this works at create issue wrokflow transition?

Sanu P Soman

3 answers

1 accepted

This widget could not be displayed.

Have a look here. You have to add cf.updateValue. More details on the link.

This widget could not be displayed.

It works with,


Many thanks for the help.

This widget could not be displayed.

The issue might not still exist when you're executing the code, so that's why it may not return proper value for the option.

Add some trace in the script to see what does the fieldConfig and option vars are not null. If they are null then check if the issue has project and issue type field set, as if they're not set fieldConfig will be alwas null

Kostas answer seems more precise... so check it first :)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

83 views 1 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