Forums

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

ScriptRunner Behaviour: Set reporter is case sensitive

Deleted user March 18, 2019

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.grafik.png

When I hard code the assignee like "SignerC"

subTaskReporter.setFormValue("SignerC")

The reporter is successfully set.

grafik.png

Does anyone know how to make this case insensitive?

Thanks and BR

Marius

1 answer

1 accepted

0 votes
Answer accepted
Mark Markov
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.
March 19, 2019

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

  

Deleted user March 19, 2019

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

Mark Markov
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.
March 19, 2019

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)
Deleted user March 19, 2019

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!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events