Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

IssueService: assignee problem

id
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2021

Hello!

My username (login) is "sa" (Active Directory connector). Earlier, using IssueService, I created issues and there were no problems. After renaming the username to "id", I started getting an error:

"[assignee:User 'sa' does not exist.]"

[VALIDATION_FAILED]

I am not using the {{params.setAssigneeId()}} method.

 

Check:

import com.atlassian.jira.component.ComponentAccessor

def user = ComponentAccessor.userManager.getUserByName( "id" );
// result = "id(sa)"

It looks like I exist with a new name "id" and with an old key "sa".

2 answers

1 accepted

1 vote
Answer accepted
Radek Dostál
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.
August 20, 2021

This sounds like the usual expected api shenanigans with lacking documentation.

User key -- persistent String key being created when the user is created, it does not change

User username -- variable, this one can change, if you do change, the key remains the same

 

In old versions, it used to be the original username, so you would have the same userkey and username until username gets changed (perhaps your case). Later on the userkey started following a more "generic" convention of JIRAUSER12345 kind of an identifier, so it no longer is confusingly the same from the start.

In any case, the key and name may seem the same, but they are not. They are used differently across the api, sometimes it matches by username, sometimes by userkey. It's inconsistent.

 

When you look into the setAssigneeId() method, it does not say anything in javadoc https://docs.atlassian.com/software/jira/docs/api/8.13.6/com/atlassian/jira/issue/IssueInputParameters.html#setAssigneeId-java.lang.String-

 

But when you look at MutableIssue.setAssigneeId() https://docs.atlassian.com/software/jira/docs/api/8.13.6/com/atlassian/jira/issue/MutableIssue.html#setAssigneeId-java.lang.String- there it states 

void setAssigneeId(String assigneeId)

Sets the user that this issue is assigned to. Note that this should be the userkey, not the username.
Parameters:
assigneeId - The user key

 

Then again as you did not show us how you are using the IssueService, I'm taking a guess.

id
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2021

Thank you very much!
You are absolutely right. The problem was really that setAssigneeId() is being used and not setAssignee().
Thanks again, problem solved.

Like John Funk likes this
0 votes
John Funk
Community Champion
August 20, 2021

Hi @id  - I would probably go ahead and put in a support ticket with Atlassian:

https://support.atlassian.com/contact/#/

Suggest an answer

Log in or Sign up to answer