Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Set assignee using User Picker custom field value post-function, error with Capital letter

Hi all,

I read a lot about this script and I would like to report a little "problem", I think the problem is in the old Jira version. (my setup: Jira 6.4.14 and script-runner  3.1.4)

The problem is this:

if user has used CAPITAL LETTER for the username.

there is not a correct connection between user Id of issue and user (no avatar of user, no issue link in "Assigned to Me").

The solution are:

- change all username lettere to lower (e.g. username = AB -> abb and after abb -> ab)

- add .toLowerCase() after user.username (I don't know if this create other problem, but I try a lot and now works)

So the "final" script is this

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.user.ApplicationUser;

def customFieldManager = ComponentAccessor.getCustomFieldManager();

def cfvalue = customFieldManager.getCustomFieldObjectByName("name of your custom field");

def user = issue.getCustomFieldValue(cfvalue) as ApplicationUser;


If you try to print the value of User Picker where the username has Capital letter

log.error(User Name is ------- user)

log.error(User is ------- user.username)

the result are these:

User Name is-------AB(ab)
User is------- AB


but if I assign the issue to AB user using the normal form and print the value

log.error(User Name is ------- issue.getAssignee())

log.error(User is ------- isse.getAssigneeId())

the result are these:

User Name is-------ab
User is------- AB:1


and the last (and the problem) if you try to print the value of Assignee after the script (without tolowerCase())

log.error(User Name is ------- issue.getAssignee())

log.error(User is ------- isse.getAssigneeId())

the result are these:

User name is -------AB
User is-------com.atlassian.crowd.embedded.impl.ImmutableUser@177ff

and ye, that's it.




1 comment

Ivan Tovbin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Aug 31, 2018


Assuming your custom field is a user picker, here's how to set an assignee;

import com.atlassian.jira.component.ComponentAccessor

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName")
def user = issue.getCustomFieldValue(cf)


Log in or Sign up to comment