import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.comments.CommentManager import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.watchers.IssueWatcherAccessor import com.atlassian.jira.issue.watchers.WatcherManager ComponentManager componentManager = ComponentManager.getInstance() Issue issue = componentManager.getIssueManager().getIssueObject("EPIC-10") User user = componentManager.getJiraAuthenticationContext().getLoggedInUser() String recipient = '' try { //Add comment to the original CommentManager commentManager = componentManager.getComponentInstanceOfType(CommentManager.class) def list = issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObject("customfield_12117")) for (u in list) { if (recipient == ''){ recipient = u.displayName } else { recipient = recipient + ', ' + u.displayName } } IssueWatcherAccessor iwa = ComponentAccessor.getComponent(IssueWatcherAccessor.class) list = iwa.getWatchers(issue, java.util.Locale) for (u in list){ if (recipient == ''){ recipient = u.displayName } else { recipient = recipient + ', ' + u.displayName } } // String comment = 'Epic has been sent to: ' + recipient + ' for approval.' // commentManager.create(issue, user.getName(), comment, true) return 'For Approval Email has been sent to: ' + recipient + ' for approval.' } catch(all) { return false }
Returns error message...
Hi Dean,
You should be given an instance of the java.util.Locale class as an argument in the method iwa.getWatchers(issue,...) .
Something like this :
Locale en = new Locale("en"); iwa.getWatchers(issue,en);
It's actually pretty clearly explained in the error message.
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Peter, do you know why I would receive this error? Stack Trace: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.getWatchersFor() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl) values: [SAND-1] Possible solutions: getWatches() . . . Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.getWatchersFor() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl) values: [SAND-1] Possible solutions: getWatches() . . . Caused by: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.getWatchersFor() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl) values: [SAND-1] Possible solutions: getWatches()
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.