Hi!
There is a script, which takes values from the issue and creates a similar one with the same assignee, reporter, ect. Now we have a problem with users, which usernames were changed in Active Directory. There is a following error while creating:
Assertion failed: assert !validationResult.errorCollection.hasAnyErrors() true Errors: {assignee=User 'sam.st' does not exist.} Error Messages: [] com.atlassian.jira.bc.issue.IssueService$CreateValidationResult@66104f3 false
"sam" is the original username, but the current one is "sam.smith".
I'm using getUserByKey() method to get an assignee and reporter values.
So, what can I use to cover such a problem? Would the method getUserByName() reliable if the User Name is changed? Which column referrs to this method?
The code looks like:
def customFieldManager = ComponentAccessor.getCustomFieldManager() //current issue Issue issue = issue def rep = issue.getReporterId() def assign = issue.getAssigneeId() //........ creating new issue issueInputParameters.with { // ..... reporterId = rep assigneeId = assign // ..... }
Thanks in advance.
So it seems:
issue.assigneeId
and:
issue.assignee.id
are two different things. The first returns the key and the second returns an actual id. Try using:
issue.assignee.name
It seems like setAssigneeId looks at the username, as you described.
Hi Saida, Glad you got it working. I have converted my comment to an answer. Would you be able to accept so other people get to see the solution too? Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I've tried to use issue.assignee.name and returned these values to the comment to see which value this method will return, seems that it works properly.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
Yes, I'm almost sure. We have several users with changed usernames and only for these ones the script returns error.
Moreover, we have the following case:
1st user renamed (from original -> to current) : sam ---> sam.smith
2nd user renamed (from original -> to current): sam.st ---> sam
And, if Assignee (or reporter) is user with current username sam.smith , for new issue the assignee will be the user with username sam . If Reporter (or assignee) is user sam , the system returns me that user sam.st doesnt exist. It looks like the getUserByKey takes the original (previous, user_key) value, and when parses it to the new issue, searchs between current usernames (lower_user_name).
These users could be found in database,
select * from app_user
where user_key <> lower_user_name
And for all these users the described problem exsists.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The assignee and reporter id should be the user key. Are you sure this is whats breaking your script? It should continue working even when users have been renamed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to use setAssignee() method instead of setAssigneeId().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.