You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi Team,
i am trying to set Assignee value from custom type user field , but i am getting value in XXXXX(XXXXX) format.
When i am trying to set the value using issue.setAssignee() i am getting null value.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.user.util.UserManager
import com.atlassian.crowd.embedded.api.User
import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger(" ")
log.setLevel(Level.DEBUG)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
UserManager userManager = ComponentAccessor.getUserManager();
def managerId = customFieldManager.getCustomFieldObjectByName("Dept Approver's(Manager) Id")
String managerIdvalue =issue.getCustomFieldValue(managerId)
ApplicationUser Mgruser = userManager.getUserByName(managerIdvalue)
log.info "managerId: "+managerId
log.info "managerIdvalue: "+managerIdvalue
log.info "Mgruser : "+Mgruser
issue.setAssignee(Mgruser )
//issue.setAssignee(Mgruser )
==========OUT PUT============
2017-08-09 10:50:20,455 INFO [ ]: managerId: Dept Approver's(Manager) Id 2017-08-09 10:50:20,456 INFO [ ]: managerIdvalue: 44018514(44018514) 2017-08-09 10:50:20,456 INFO [ ]: Mgruser : null
issue.setAssignee(Mgruser) --> should assign the value of "Mgruser " into Assignee.
but "Mgruser" is getting null value.
please advise how to get username from coustomfield and set it to Assignee default field.
yes, we have users with username as numerical ids and full name as usual. i need to assign user with this numerical id.