Hello! I have this script, but it isn't assigning the watchers when it goes through the "create issue" transition. I was hoping to assign these people as watchers for this specific issue type we have. What might be wrong with it? I'm not strong at scripting, at all...so this is all pretty foreign to me. Thank you for your help!
import com.atlassian.jira.component.ComponentAccessor
def issueTypeWatchers = [
'Spares and Repair Parts': ['DG1459', 'BK8615','MS9025'],
]
issueTypeWatchers[issue.issueType.name].each{userName->
def user = userManager.getUserByName(userName)
def watcherManager = ComponentAccessor.getWatcherManager()
}
Hey Ashley,
You should be able to achieve this easily with our new HAPI feature, introduced in ScriptRunner for Jira 7.11.0
def issueTypeWatchers = [
'Task' : ['task-watcher-a', 'task-watcher-b']
].withDefault { [] }
issueTypeWatchers[issue.issueType.name].each { watcher ->
issue.addWatcher(watcher)
}
You will need to move the ScriptRunner post function down to the bottom of the list.
For more information on HAPI, see the following links:
Cheers :)
The values here are usernames, not user keys by the way.
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.