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

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

Scriptrunner: display the user's name instead of userID in custom e-mail

Hi!

 

I am trying to configure a custom e-mail in Scriptrunner to my company and I faced something I cannot work out. I tried to figure out based on other topics discussed here but I could not solve it so far. Also I am not an IT person :)

 

I created a custom field called Requestor (single user picker) and I would like to send an e-mail to this person now starting with

Dear XY (requestor's name) ...

 

I used these:

<% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldValueByName("Requestor")) %>

and

${cfValues['customfield_name'] ?: ""}

and I get this result:

FeBiro(JIRAUSER43110)

how can I put the Full Name value there?

 

Thanks in advance

1 answer

Hi Félix,

Not sure if this works from the mail but here's the sample script to get user's full name:

import com.atlassian.jira.user.ApplicationUser

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectsByName("Requestor")[0]
def sponsor = issue.getCustomFieldValue(cField) as ApplicationUser

def fullName = sponsor.displayName

Hope this helps! 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

462 views 16 17
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