custom fields inside email

JAB April 25, 2016

Hello,

We are having an intermitted issue with displaying a custom field in an automatic generated email.
We updated the files per “Adding Custom Fields to Email” https://developer.atlassian.com/jiradev/jira-platform/jira-architecture/jira-templates-and-jsps/adding-custom-fields-to-email
And the field “Program Number” shows up sometimes but not in every email that is created during “Issue Creation”.

 

Thanks

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 25, 2016

Is the field always set?  Are the workflows all firing the same "issue created" event for all issue creations?  Is the code for the field in the template just a simple "if populated put it in email" or something more complex?

JAB April 26, 2016

Hi Nic,

here is the code we used to add the "program number"

#if ($issue.getCustomFieldValue("customfield_10000"))
$stringUtils.leftPad($issue.getCustomField("customfield_10000").name, $padSize): $issue.getCustomFieldValue("customfield_10000")
#end

The field always has a numeric value but doesn't always show up in the actual email

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2016

Are all the workflows firing the right events to trigger the use of this template?

Does the field show anything in the email at all?  (i.e. field name appears, but content is empty)

JAB April 26, 2016

Are all the workflows firing the right events to trigger the use of this template? I am waiting to hear from the user who noticed the problem.

Does the field show anything in the email at all?

Nothing, no label nor any data even though it is available on the "Create Issue" form email_program_number.jpg

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2016

Ok, that implies your code is working, and the field is empty at creation.  So the next question is - can we find a create-issue email which missed the field,and have a close look at the history - specifically for that one field - has it been changed at all on that issue?

We do need to take a look at the events going out and transition post-functions for create as well.

JAB April 27, 2016

How can I find the history for an issue email?

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2016

Sorry, I don't understand.  Could you look at the history of the issue (for which an email was sent without the field)?

JAB April 29, 2016

Nic,

I changed the script in "issuetype.vm" by adding these lines

#if ($issue.getCustomFieldValue("customfield_10000"))
<tr><th>$stringUtils.leftPad($issue.getCustomField("customfield_10000").name, $padSize):</th><td>$issue.getCustomFieldValue("customfield_10000")</td></tr>
#end

user reported back to me that its working in multiple projects now.  Thank you for taking time to help us out.

Joe

Suggest an answer

Log in or Sign up to answer