It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Roman Joss Jun 07, 2017

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.
Roman

2 answers

1 accepted

0 votes
Answer accepted
PhillipS Dec 01, 2017

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"
Nadhima Brandis Apr 12, 2018

Hi Philip 

Thank you for posting this solution. I was able to get the scripted field working in Jira. 

However, it still would not display the scripted field in Confluence. 

Can you please advise what type of scripted field you created. 

We are using confluence 5.9, quite outdated, not sure if this is the cause. 

Thank you

Nadhima

PhillipS Apr 12, 2018

I created an HTML field type, but I would think it works with Text Field as well?

we are on Jira Server v7.3.8

Adaptavist Scriptrunner for JIRA v5.3.9

Nadhima Brandis Apr 12, 2018

Philip, was an issue on our end, we worked it out. Thank you for your solution.

Like Alexey Sych likes this
Roman Joss Apr 12, 2018

Hi Philip

I'm sorry for my late reply. I almoust forgot that, but but today i had the messages in the inbox.

Your scripted field work perfect, even if we use german special characters. That is a solution for single Projects where the users aks for. Unfortunately not all users asks at the support.

As we try to Keep the amount of fields as small as possible, it is also a bit pity that this results in additional fields. But it is a workaround.

Thanks for your help!

0 votes
PhillipS Dec 01, 2017

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

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

2,684 views 6 15
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you