Adding Custom Fields to Email
This tutorial shows you how to print a custom field in an email. Note, there is an open feature request to integrate this into JIRA, which is tracked here: JRA-4619.
1. Find the Custom Field ID
The Custom Field ID can be discovered from the database or by examining the URLs of custom field pages.
To find the Custom Field ID by examining the URL of a custom field page:
- Navigate to the Custom Field configuration in the JIRA administration console, as described on Configuring a Custom Field.
- Click the cog icon to display the menu for the custom field.
- Hover your mouse over the Configure item in the menu. The URL will display in the footer of your browser. The URL will show the Custom Field ID.
For example, in this screenshot, the ID of the custom field is 10000:
To find the Custom Field ID by querying the database:
Run the following query on your database:
2. Edit the velocity template
Locate the Velocity template of the email type you wish to modify. For instance, you may want to modify the 'issue created' template, as well as the template reused in 'issue commented':
Add the following snippet where you want it to appear in the file:
atlassian-jira/WEB-INF/classes/templates/email/text/includes/issuesummary.vm you will want:
Note: you need to change the custom field id to the id observed in step 1. Here it is 10000 - yours will probably be different.
If you wish to iterate over all related custom fields you can use the following example:
3. Restart JIRA
To make the changes take effect, restart JIRA. If you wish to avoid the continual restarts during testing, edit
atlassian-jira/WEB-INF/classes/velocity.properties and alter this section as the comment says: