Hello everyone! I have a code which add watchers in issue.
but now I need to add a user only if the task : task type is "my task type" and it has a field "my cf select list" and the option "Yes" is selected there. Please tell me how can I do this? Thank you.
import com.atlassian.jira.component.ComponentAccessor
def userManager = ComponentAccessor.getUserManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def watcher = ["username1","username2"]
watcher.each{userName->
def user=ComponentAccessor.userManager.getUserByName(userName)
watcherManager.startWatching(user, issue)
}