Hello
Perhaps this classifies as a bug report but I'm not sure yet.
I have a behaviour where I try to set the reporter of a sub task to the same user as the parent's assignee.
I am able to retrieve the username of the assignee like so.
Long parentIssueId = getFieldById("parentIssueId").getFormValue() as Long
def parentIssue = issueManager.getIssueObject(parentIssueId)
def parentIssueAssignee = parentIssue.assigneeId as String
Extract from log.
[c.o.j.groovy.user.FieldBehaviours] --------------------This is to test Behaviours Logging----------------
[c.o.j.groovy.user.FieldBehaviours] signerc
I then try to set it like so.
def subTaskReporter = getFieldById(REPORTER)
subTaskReporter.setFormValue(parentIssueAssignee)
However, the reporter does not change.
When I hard code the assignee like "SignerC"
subTaskReporter.setFormValue("SignerC")
The reporter is successfully set.
Does anyone know how to make this case insensitive?
Thanks and BR
Marius
Hello @[deleted]
If i remember correctly user picker fields in setFormValue method accepts user keys, not ids.
try it
Long parentIssueId = getFieldById("parentIssueId").getFormValue() as Long
def parentIssue = issueManager.getIssueObject(parentIssueId)
def parentIssueAssignee = parentIssue.assignee.key as String
Hi @Mark Markov
Thanks for your help.
Unfortunately, this did not work. The output is the same: signerc
The assignee remains to my user and not his.
BR
Marius
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hmmmm, in my case it work. Whats scriptrunner version?
Anyways, it work with case sensitive text, so lets make some research. ApplicationUser have many parameters, let see which one contains right text.
try to
log.error(parentIssue.assignee.name)
log.error(parentIssue.assignee.displayName)
log.error(parentIssue.assignee.username)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
we're currently on version 5.5.0.3-jira8
parentIssue.assignee.username did the trick! :)
The username comes as SignerC which works to set the reporter. However, I think I'll open up a bug report as I'd say it should also work with signerc. We'll see what Adaptavist will have to say about this.
Thanks a lot!
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.