Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×Hi All,
We would like to Customize JIRA email notification on particular project tickets so that it adds "Originating Project" field to the email notification. Please let us know how we can achieve this?
Support team suggested below documentation but not sure how we can modify the templates. Moreover i am new to scripting.
https://confluence.atlassian.com/adminjiraserver071/customizing-email-content-802592932.html
Can someone please help me in achieving my task?
Thanks,
Sunil Palugula
@Tom Lister Sorry for the late reply.
I have tried but still not able to print the custom field. Just want to let you know that the custom field which i am trying to print is not used by all the projects in our JIRA not sure if this is causing the issue.
Also can you please confirm if we can print any custom field in the email notification even though it is not used in all the available projects.
Thanks,
Sunil Palugula
Hi Sunil
its usual for fields not to be available in all projects and issues and your check for the value before using it will handle that.
My suggestion is to put some fixed text in the template to first confirm the velocity files are being used and the location of your snippet is being processed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tom,
Thanks for the update, I will give it a try and let you know as soon as i am done.
Thanks,
Sunil Palugula
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tom,
Thanks for the update - I have also followed the below page but still not able to see the custom field in the email, If possible can you please list out steps
https://developer.atlassian.com/server/jira/platform/adding-custom-fields-to-email/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sunil Kumar
could you post what you have done so far including template
you mention wanting Originating Project fields on particular tickets. You can either create a separate template file and event, add a mapping between them, then ensure your workflow fires that event correctly
or you can put a check in your template
I’d be interested to see what you’ve tried so far
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tom Lister
Thanks for the quick response, please see below for what i have done.
Note: I have done all the steps as per the document https://developer.atlassian.com/server/jira/platform/adding-custom-fields-to-email/
1. I have first identified the custom field ID
2. updated below two templates with content below templates.
atlassian-jira/WEB-INF/classes/templates/email/text/issuecreated.vm atlassian-jira/WEB-INF/classes/templates/email/text/includes/issuesummary.vm
issuecreated.vm
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_11405"))
#if ($issue.getCustomFieldValue($customfield))
$stringUtils.leftPad($customfield.name, $padSize): $issue.getCustomFieldValue($customfield)
#end
issuesummary.vm
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_11405"))
#if ($issue.getCustomFieldValue($customfield))
>$stringUtils.leftPad($customfield.name, $padSize): $issue.getCustomFieldValue($customfield)
#end
3. Restart JIRA and tried commenting on one of the project and tried creating the issue but still email does not have custom field printed on the emails.
Thanks,
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
ill take a look on my machine when I get to my desk
could you try removing the #if #end and see what is shown in email
i’d expect to either see the name or get a null pointer exception
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
this requires a long answer! To start with work through the info in the confluence page and put a fixed piece of text in your mail template to test you have the right file and behaviour.
template are simple text files you can edit if you have access to them
once done we can look at th field required
Velocity is fairly straight forward
try https://developer.atlassian.com/server/confluence/basic-introduction-to-velocity/
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.