Our system was upgraded to 8.0.2 and now getting this error:
Compilation error(s): script1551890638056291169545.groovy: 4: unable to resolve class com.atlassian.jira.ComponentManager @ line 4, column 1. import com.atlassian.jira.ComponentManager
Any suggestions on how to get script working again? Here is the whole script
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
/* */
def cField = customFieldManager.getCustomFieldObject(10600)
def cFieldValue = issue.getCustomFieldValue(cField)
String FieldName = cFieldValue
/* */
def cField1 = customFieldManager.getCustomFieldObject(10601)
def cFieldValue1 = issue.getCustomFieldValue(cField1)
String FieldName1 = cFieldValue1
/* */
def cField2 = customFieldManager.getCustomFieldObject(10603)
def cFieldValue2 = issue.getCustomFieldValue(cField2)
String FieldName2 = cFieldValue2
/*def cField1 = customFieldManager.getCustomFieldObject(Desired_Semester)
def cFieldValue1 = issue.getCustomFieldValue(cField1)*/
String FieldConcat = (FieldName + " " + FieldName1 + " " + FieldName2)
return FieldConcat;
We tried to distil what we think will be important to our users in our release notes too: https://scriptrunner.adaptavist.com/latest/jira/releases/UpgradingToJira8.html
Its in the realase notes
https://confluence.atlassian.com/adminjira/preparing-for-jira-8-0-955171967.html
under Component Managed Moved, sorry i havent upped yet so not yet refactored so thats all i know
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An alternate approach is using ComponentAccessor instead, and you may see the API documentation for this class here:
https://docs.atlassian.com/software/jira/docs/api/7.11.0/com/atlassian/jira/component/ComponentAccessor.html
getComponent and getComponentByType are two key methods to load components of a specific type. Sample code is below:
Old Code:
RemoteIssueLinkService remoteIssueLinkService = ComponentManager.getComponentInstanceOfType(RemoteIssueLinkService.class)
RemoteIssueLinkService.RemoteIssueLinkListResult links = remoteIssueLinkService.getRemoteIssueLinksForIssue(currentUser, issue)
New Code:
RemoteIssueLinkService.RemoteIssueLinkListResult links = ComponentAccessor.getComponentOfType(RemoteIssueLinkService.class).getRemoteIssueLinksForIssue(currentUser, issue);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much for that information. I found what I needed - the new location for Component Manager (com.atlassian.jira.component.pico
package)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.