Hi, I'm running a JQL using Escalation service (Scriptrunner), for the below code; having issues in resolving warning. any help !!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys
import com.atlassian.jira.config.SubTaskManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.ComponentManager
ComponentAccessor.commentManager.create(issue, "jira_admins","Hello [~${issueUser}], Please check the status of the RCA.", true)
Error: (though the comment gets added. still warning is thrown)
at com.onresolve.scriptrunner.jobs.JiraIdentitySwitchingService.switchIndentityAndExecute(JiraIdentitySwitchingService.groovy:27)
at com.onresolve.scriptrunner.jobs.IdentitySwitchingService$switchIndentityAndExecute.call(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.jobs.EscalationService$_execute_closure2.doCall(EscalationService.groovy:129)
<<<<some deleted data>>>>>
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: There is no ID mapped for the user key 'JIRA_Admins'
at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:32)
at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:25)
at com.atlassian.jira.user.preferences.DefaultUserPreferencesManager.getExtendedPreferences(DefaultUserPreferencesManager.java:22)
at com.atlassian.jira.bc.issue.watcher.AutoWatchService.isAutoWatchEnabledForUser(AutoWatchService.java:56)
at com.atlassian.jira.bc.issue.watcher.AutoWatchService.onIssueEvent(AutoWatchService.java:43)
at sun.reflect.GeneratedMethodAccessor2245.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40)
... 405 more
IssueUser is working fine; taking the current issue assignee else reporter.
I tried with below, but no comment was posted; it took the wrong user.
issueInputParameters.setComment('Added comment')
Also, History shows that I've added all labels again; is there way to add comment (only 1) by a particular user only. ie. to replace the loggedinuser code below with ex/ jira_admins user key.
LabelManager labelManager = ComponentAccessor.getComponent(LabelManager.class)
labelManager.addLabel(ComponentAccessor.jiraAuthenticationContext.getLoggedInUser(), issue.id, "RCA_AUTO", false)