Hi there
We have created an e-mail template in jira.
Is there a way to have the repoter/assignee (or custom field (pick user)) show the email address of the user and not the username?
(Jira on Premise)
Thank you!
Best Regards
assuming they are not batched notifications (they work a bit different) it should be possible - however, I have no ready-solution but probably something you could investigate further.
Judging by the path you mentioned I believe you are not using batched notification so the following could be a start.
I read here: https://community.atlassian.com/t5/Answers-Developer-Questions/How-do-I-display-the-full-name-of-a-user-picker-custom-field-in/qaq-p/491290
about an example: ($issue.getCustomFieldValue("customfield_10094").name)
It could work - when the value "name" is replaced by the matching part for e-mail. Just a guess: you could try something similar with .email or probably .emailAddress (in Community there can be found information that the one or another worked in the past - however, I suspect there were additional Apps involved, why it might be it will not work for you, unfortunately).
Of course, please adapt the said above to your template.
If it does not work a solution could probably be to fetch the mail address with some kind of scripting solution and put it to a dedicated custom field of type "email". This should be easier to access via Velocity templates. However, I recognize this would require an App and you have not stated if you have one in your instance (probably not willing to pay another one) - also, it would be a quite hacky way.
Would be interested in what you find out!
Regards,
Daniel
Hi
Thank you very much for your answer
i tried with .email and .emailAddress and i got
.emailAddress = Anonymous
.email = unassigned
I have to investiged more, I will get back to you as soon as I have news.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i tried again, and now it works.
i used: (user picker customfield)
#text($issue.getCustomFieldValue("customfield_10200").emailAddress)
my whole customfield.vm looks like:
#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_10200"))
#if($issue.getCustomFieldValue("customfield_10200").name)
<tr>
<th>#text($customfield.name):</th>
<td class="has-icon">
#text($issue.getCustomFieldValue("customfield_10200").emailAddress)
</td>
</tr>
#end
if you would like to show the whole username:
#authorlink($issue.getCustomFieldValue("customfield_10201").name)
#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_10201"))
#if($issue.getCustomFieldValue($customfield))
<tr>
<th>#text($customfield.name):</th>
<td class="has-icon">
#authorlink($issue.getCustomFieldValue("customfield_10201").name)
</td>
</tr>
#end
im not a developer, so there can be some mistakes, use at your own risk :)
Best Regards
Luca
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great - I'm glad you got it solved!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can edit the template files on server level, but i'm not sure that you can implement this specific thing.
I never did i myself and i always recommend customers not to edit those as this would mean that with every upgrade you need to modify all the templates again.
Regards
Dave
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your response.
I edited the templates here :
/opt/atlassian/jira/atlassian-jira/WEB-INF/classes/templates/email/html/
Till now, i was not able to create a custom field (pick user) with e-Mail address.
Is there any code or script which can be added to the custom-filed (customfield.vm) with that i can catch the e-mail address of a user?
Best Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.