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

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

127 views 0 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