Hi, I'm very new to Scriptrunner, and I need help! I want to grab the user from a custom field (Business Analyst) and add them to Watchers. I cobbled together a script from a couple of other similar questions here, took out what it looked like I didn't need (and maybe took out too much!), and came up with this:
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;
def cf1 = customFieldManager.getCustomFieldObjectByName("Business Analyst");
def userid = issue.getCustomFieldValue(cf1);
def watcherManager = ComponentAccessor.getWatcherManager();
def userManager = ComponentAccessor.getUserManager();
def user = userManager.getUserObject("userid");
if (user) watcherManager.startWatching(user, issue.genericValue);
On the last line, I get the error [Static type checking] - Cannot find matching method com.atlassian.jira.issue.watchers.WatcherManager#startWatching(com.atlassian.jira.org.ofbiz.core.entity.GenericValue). Please check if the declared type is right and if the method exists.
If someone could help me straighten this out, I would really appreciate it.