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 {it.name == 'BI Deployed to Environment'} def new_value = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.toString() == 'UAT' } def current_options = parent.getCustomFieldValue(checkbox_cf); checkbox_cf.updateValue(null,parent,new ModifiedValue(parent.getCustomFieldValue(checkbox_cf), current_options + [new_value]),changeHolder);
The error is occurring on
current_options + [uat_value]
Can anyone help?
Thanks guys the answers is -
def customFieldManager = ComponentAccessor.getCustomFieldManager()
Try
def customFieldManager = ComponentAccessor.customFieldManager
or
def customFieldManager = ComponentAccessor.getCustomFieldManager()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe the customFieldManager must be gotten by a function instead
def customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sam,
Did you turn on debugging and check what log file says ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.