How do we create post function which changes assignee based on system field (component)?

Sonal Jolly
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 22, 2019

Hi,

I'd like to get the assignee name changed as we transition in the workflow. We tried script runner and some example script below. But it gives us error.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
String userName;
def csProduct = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("components")
switch(issue.getCustomFieldValue(csProduct)){
case "Clock Tree": userName = "abc";break;
case "Database": userName = "xyz";break;

}
log.error(userName)
log.error(issue.getCustomFieldValue(csProduct));
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))

1 answer

0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2019

Maybe I don't understand the use case here but if you are using Components you can set the component lead thereby ensuring that any issues will get set to the proper person based upon the component selected.

Suggest an answer

Log in or Sign up to answer