How do I Make Assignee ?

I want the assignee to be chosen for xx.yy when DPT selected where as when YGLS selected, I want to see the yy.xx user as an assignee. Adding the code post functions, but it neither works nor gives an error. How can I solve this problem? Which part I should correct at the code?

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.index.IssueIndexManager
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager;
import com.atlassian.jira.issue.link.IssueLinkType
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.index.IssueIndexManager
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager;
import com.atlassian.jira.issue.link.IssueLinkType
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.security.roles.ProjectRoleActors
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.security.roles.ProjectRoleActors
import com.atlassian.jira.security.roles.ProjectRoleManager

ComponentManager componentManager = ComponentManager.getInstance()
ProjectManager projectManager = componentManager.getProjectManager()
ProjectRoleManager projectRoleManager = ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class) as ProjectRoleManager
UserUtil userUtil = ComponentAccessor.getUserUtil()
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
ch = new DefaultIssueChangeHolder();
Issue issueCurrent = issue
IssueManager issueManager = ComponentAccessor.getIssueManager()
userManager = (UserManager) ComponentAccessor.getUserManager()
CustomField proje_customField = customFieldManager.getCustomFieldObject(customfield_10211)
String selectboxValue= issue.getCustomFieldValue(cf_user).getValue();


if(selectboxValue == "DPT"){
User assigneeUser = userManager.getUser('xx.yy');
issueCurrent.setAssignee(assigneeUser)
}else if(selectboxValue == "YGLS"){
User assigneeUser = userManager.getUser('yy.xx');
issueCurrent.setAssignee(assigneeUser)
}

log.warn("ERRORLOG:"+selectboxValue+"____"+assigneeUser)

 

2 answers

This widget could not be displayed.

Have you tried seeing if you select list is retrieving any value? also in which format. Sometimes the value return ends up beeing the value id, e.g.14214

This widget could not be displayed.

What Does it mean ? Can you pls show me example ? Sorry I am new this Job.

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

143 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you