Hello All,
I have added below script in script runner postfunction on create transition to automatically add user to the Watcher field on create transition. But below script is adding only single user to the watcher field, How do i add multiple users to watchers field?
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue
def userName = "Atanu_Mandal" // name of the user
def userManager = ComponentAccessor.getUserManager()
MutableIssue issues = issue as MutableIssue
def user = userManager.getUserByName(userName)
def watcherManager = ComponentAccessor.getWatcherManager()
watcherManager.startWatching(user, issue)
Thanks in advance,
CH