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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot Set Assignee of Sub-Task with ScriptRunner Edited

I have 15 post-function sub-tasks that all have almost the same exact format in which I set the assignee and additional assignee(custom field).

For this particular sub-task, I cannot get the sub-task to set the assignee correctly to the username I have, instead, once the sub-task is created, the Assignee is only set to the username text and not the actual agent and if I try to select from the Assignee drop-down list, it also just lists the username text from the script and I can no longer select their normal Jira full name from the drop-down list in the parent ticket and sub-tasks related. If I go to any other ticket and/or sub-task, I can select them normally as an Assignee. Once I unassign the original sub-task or assign to someone else, I can then also select the agent from the drop-down list normally. When looking at the ticket Activity, I noticed something strange, it sets the assignee to some generic Jira Username with numbers, screenshot attached.

Below is the script

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


issue.setDescription("--Remove user's name from telephone description\n--Change telephone owner to anonymous\n--Delete voicemail account\n--Delete extension from AD account")




1 answer

1 accepted

0 votes
Answer accepted
Hana Kučerová Community Leader Dec 17, 2020

Hi @Midnite8 ,

according to the documentation setAssigneeId expects to get userkey (not username). Your problem is probably related to the GDPR changes - new users have userkey like JIRAUSER10100 and it is not same as username anymore.

@Hana Kučerová Hmm, interesting, that does seem like the case. The user is relatively new so that explains why. What is the solution? Do I use the userKey instead or is that randomized every time?

nevermind, just tried using the userKey instead and it worked! Thank you!

Going forward, how do I find the userKey of Jira users?

Hana Kučerová Community Leader Dec 20, 2020

Hi @Midnite8 ,

you can get it using groovy script like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager

UserManager userManager = ComponentAccessor.getUserManager()
ApplicationUser user = userManager.getUserByName("username")
String userKey = user?.getKey()

Actually I don't know any easy way how to do it as a Jira administrator, so I asked myself here.

@Hana Kučerová, I found out another kind of workaround to find out the userKey. I have a DEV project and just normally set the username in the Groovy script, I then create the ticket as normal with the groovyscript in the post-function workflow and after the ticket gets created with the invalid username I set the assignee or Unassigned or myself and I can see from the Jira activity what the userKey is.

Like Hana Kučerová likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

639 views 10 16
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you