I hope this is an easy one - I am testing out my script ( I know I will have to add an event issue when I finalize my script I am just testing with one issue for now)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.event.issue.IssueEventBundle
import com.atlassian.jira.event.AbstractEvent
import com.atlassian.jira.security.roles.ProjectRoleManager
IssueManager im = ComponentAccessor.getIssueManager()
MutableIssue issue = im.getIssueObject("MH-5548")
def watcherManager = ComponentAccessor.getWatcherManager()
def userUtil = ComponentAccessor.userUtil
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_10625")
def system = cField.getValue(issue)
if(system == "Looker (BI)") {
userUtil.getAllUsersInGroupNames(['BI']).each { user ->
watcherManager.startWatching(user, issue)
}
} else {
return "hello"
}
For some reason when I test the value I get null. When I return system I get [Looker (BI)] which I'm assuming it is returning a value within a list.
I'm not sure what I am doing wrong here.