Groovy Script doesn't work JIRA 7

Since upgrading to JIRA 7 my script on Scriptrunner to update a check box is no longer working.

The script finds the checkbox with it's existing values and adds a new value. 

def checkbox_cf = customFieldManager.getCustomFieldObjects(parent).find { == 'BI Deployed to Environment'}
def new_value = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.toString() == 'UAT' }
def current_options = parent.getCustomFieldValue(checkbox_cf);

current_options + [new_value]),changeHolder);

The error is occurring on 

current_options + [uat_value]

Can anyone help?

6 answers

1 accepted

Thanks guys the answers is - 

def customFieldManager = ComponentAccessor.getCustomFieldManager()



Hi Sam,

              Did you turn on debugging and check what log file says ?

I'm getting this error in the logs -

groovy.lang.MissingPropertyException: No such property: CustomFieldManager for class: com.atlassian.jira.component.ComponentAccessor
Possible solutions: customFieldManager


I declare the customfieldManager like this - 

def MutableIssue parent = (MutableIssue) issue.getParentObject();

ComponentManager componentManager = ComponentManager.getInstance();
def customFieldManager = ComponentAccessor.CustomFieldManager
def optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class)
def changeHolder = new DefaultIssueChangeHolder();

I believe the customFieldManager must be gotten by a function instead

def customFieldManager = ComponentManager.getInstance().getCustomFieldManager()


def customFieldManager = ComponentAccessor.customFieldManager


def customFieldManager = ComponentAccessor.getCustomFieldManager()


Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

211 views 1 18
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