HI All,
I'm using groovy script to make a particular user as a assignee on selection of an option in single select custom field. This custom field is having multiple contexts .
My script is taking only few options from the custom field list and ignoring the others. I think, i'm missing out a logic on adding the exact context which my project is using.
Please help me in this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.event.type.EventDispatchOption
def systemUserMap = [
Option1: "abc",
Option2: "cde",
["Option3" ,"Option4","Option5" ] : "efg"
]
if(webwork.action.ActionContext.getRequest().getParameter("assignee") == '-1'){
String userName;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObjectByName("Track")
def cfTrack = issue.getCustomFieldValue(cf)
if(cfTrack ) {
userName = systemUserMap[cfTrack.value]
log.error(userName)
log.error(cfTrack);
def assignee = ComponentAccessor.userManager.getUserByName(userName)
issue.setAssignee(assignee)
}
}