Hello
I have written some code for "clone and link issue" post fuction which selects component in new ticket based on custom field selection. it works fine on test environment but for some reason throws errors on production.
def select = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("CASD Component")
def selectValue = issue.getCustomFieldValue(select).toString();
ProjectManager projectManager = ComponentAccessor.getProjectManager()
Project project = projectManager.getProjectObjByKey("CASD")
ProjectComponent component = ComponentAccessor.getProjectComponentManager().findByComponentName(project.getId(), selectValue)
issue.setComponent([component])
2018-07-23 06:35:00,165 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2018-07-23 06:35:00,166 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: FSD-7537, actionId: 131, file: null
java.lang.NullPointerException: Cannot get property 'id' on null object
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue.doScript(CloneIssue.groovy:149)
I have no idea why it is not able to get the project object properly. I have also tested it with getProjectObjByName and i get the same results.
Versions of jira and scriptrunner on both environments are the same, any ideas?