Missed Team ’24? Catch up on announcements here.

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

Script Field User Picker

Yevhen L December 26, 2016

Custom script field with "User Picker (single user)" template always shows "Anonymous"

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
def CommentManager = ComponentAccessor.getCommentManager()
if (CommentManager.getLastComment(issue)) {
    def lastCommentAuthor = (ApplicationUser) CommentManager.getLastComment(issue).getAuthorApplicationUser()
    return lastCommentAuthor
}

If I check class of "lastCommentAuthor" via .getClass(), I'll get class com.atlassian.jira.user.DelegatingApplicationUser which looks correct, but for some reason ScriptRunner can't make a user from this data.

Moreover, even example code returns Anonymous.

What's wrong?

JIRA 6.4.9, ScriptRunner 4.1.3.23

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Thanos Batagiannis [Adaptavist]
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.
December 27, 2016

Hi Yevgen,

Can you double check that your scripted field Searcher is User Picker Searcher ?

 

Yevhen L December 27, 2016

Thank you, it works now. Worth to mention this nuance in the documentation.

TAGS
AUG Leaders

Atlassian Community Events