Hello,
I have been reading a lot of community Q&A about using Scriptrunner to add a watcher on create based on a custom field. I put this together, added it after Creates the issue originally and after Re-Index and issue. It is not giving me an error, and there have been no failures on executions, but it is also not adding the watcher. Anyone care to opine? In case it matters, jira server v8.3.4 and Scriptrunner v5.6.2
import com.atlassian.jira.component.ComponentAccessor
def userManager = ComponentAccessor.getUserManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
def cf = cfManager.getCustomFieldObject("customfield_xxxxx")
def user = userManager.getUserByKey("uname")
def cfFieldValue = issue.getCustomFieldValue(cf)
if (cfFieldValue == 'Value'){
watcherManager.startWatching(user, issue)
}