How to assign issue to a user based on custom cascade field value?

Kyle Heath March 20, 2019

Hello,

I have a requirement to auto assign issues based on a cascading list custom field. This will be executed on the create transition post function. I would like to use Scriptrunner, as we already own it. I have tried a few different suggestions from other community posts, but cannot seem to get any of them to work. I have placed this post function last in the list. Here is the script I am currently attempting to use: 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

String user;

def cfManager = ComponentAccessor.getCustomFieldManager();
def cf = cfManager.getCustomFieldObjectByName("New Product");

switch(issue.getCustomFieldValue(cf) as String){
case "1": user = "user1";break;
case "2": user = "user2";break;
case "3": user = "user3";break;
}

issue.setAssignee(ComponentAccessor.getUserManager().getUserByKey(user))

 

Is there something different that I need to use for a cascading field?

Any suggestions you might have would be greatly appreciated. Thanks!

1 answer

0 votes
Kyle Heath March 27, 2019

Can anyone provide some guidance on this?

Suggest an answer

Log in or Sign up to answer