How to display user name of user picker field in Jira Issue Macro

We use in Issues a customfield with a user picker. If i use the Jira Issue Macro in Confluence, the user picker field shows only the user-id and not the user name.

Is there a way i can show the user name instead of the user id?

Thanks for your tipps.

2 answers

Roman - 

    I came here looking for an answer to the same problem.  I'm going to spend some time looking for an answer for something straight out of the box, but I know this can be accomplished by making a simple scripted field that pulls the information out of the user picker and then displays the name in a separate field based on the script.


    I'll report my findings back here, whether I find something out of the box or develop a script

Roman - 

    I did about 5 minutes of digging and quickly found that everyone is coming up with custom code solutions to this problem.  My solution, for instance, is needed to display the full name on a report in confluence, but we don't really care if it shows up in jira (but it easily could by adding it to the screen if needed).  I created a scripted field under admin->add-ons->scripted fields (this is a plugin you'll need, but pretty much everyone has it).

The Code is below

import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("The Name of your User picker custom field")
ApplicationUser user = (ApplicationUser)issue.getCustomFieldValue(customField)
return user ? user.getDisplayName() : "No User"

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,312 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot