hello everybody,
i want to generate a comment over script runner and a groovy script when executing a transition.
that is the script. i want to read the value in the reporter-field
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.user.*;
import com.atlassian.jira.issue.fields.DefaultFieldManager;
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser();
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
reporter = ""+issue.getFieldValue( ComponentAccessor.getFieldManager().getFieldObjectByName("Reporter")).displayName
wertreporter = issue.getFieldValue(reporter)
reporter = "Hallo *" + wertreporter + "*, \
\n\ndein Notebook wird vorbereitet.\
\n\nGrüsse\
\nTechnical Services"
CommentManager commentMgr = ComponentAccessor.getCommentManager()
commentMgr = (CommentManager) ComponentAccessor.getComponentOfType(CommentManager.class)
//Der wirkliche Kommentar
commentMgr.create(issue, currentUser, reporter, true)this is the error:
Time (on server): Wed May 24 2017 13:13:53 GMT+0200 (W. Europe Daylight Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2017-05-24 13:13:53,894 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2017-05-24 13:13:53,894 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: ITSD-161, actionId: 61, file: /data/jira/home/groovy/ts-jsd-notebook-change-deployment.groovy
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.fields.DefaultFieldManager.getFieldObjectByName() is applicable for argument types: (java.lang.String) values: [Reporter]
at ts-jsd-notebook-change-deployment.run(ts-jsd-notebook-change-deployment.groovy:14)can somebody help?
toni