Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

  1. Go to Notifications -> Theme -> Create
     

  2. Image RemovedImage Added

    Select the theme, e.g. JIRA (System) as your source of templates and select the Issue Template Sets required (CTRL + left mouse click).
     

  3. Image RemovedImage Added

    Submit. This will copy the JIRA theme, 3 Template Sets and it will take you to the new theme edit screen.  In the macro tab, replace the jemhIncludeStandardActionHeader and  jemhIncludeBody macros with the macros below.
     

...

Support Jira Header Macro
Depracted (Old)
Code Block
#macro ( jemhIncludeStandardActionHeader)
<tr> 
	<td id="header-pattern-container"> 
		<table id="header-pattern"> 
        	<tr> 
        		#if ($context.user) 
            	<td valign="top" id="header-avatar-image-container">
                   #if ($jemhUtils.isCreatedByEmailUser()) 
                   <IMG height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" SRC='$jemhUtils.inlineImage($jemhUtils.getImageUrl("EmailUserIcon1"))' alt='$messageUtils.getMessage("velocity.macro.action.header.emailUser")'/>
                #elseif($jemhUtils.hasUserRole($jemhUtils.getOperationUser(),'developers'))
                   <IMG height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" SRC='$jemhUtils.inlineImage($jemhUtils.getImageUrl("SupportUserIcon4"))' alt='$messageUtils.getMessage("velocity.macro.action.header.support")'/>
                   #else
                   <IMG class="image_fix" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" SRC='$jemhUtils.inlineImage($context.user.avatarUrls["32x32"].asText())' alt='$context.user.displayName.asText()'/>
                   #end
                </td> 
                <td id="header-text-container" valign="middle"> 
                   #if ($jemhUtils.isCreatedByEmailUser())
                   		<span>$messageUtils.getMessage('velocity.macro.action.header.emailUser')</span>
                   #elseif($jemhUtils.hasUserRole($jemhUtils.getOperationUser(),'developers'))
                   		<span>$messageUtils.getMessage('velocity.macro.action.header.support')</span>
                   	#else
                   		<a class="user-hover" rel="$context.user.name.asText()" id="email_$context.user.name.asText()" href="$baseurl/secure/ViewProfile.jspa?name=$context.user.name.asText()">$jemhUtils.htmlEscape($context.user.displayName.asText())</a> 
                   	#end
                   <strong>$messageUtils.getMessage("velocity.macro.action.header.$jemhUtils.webhookEvent")</strong> $messageUtils.getMessage('velocity.macro.action.header.anIssue')
                </td>
                 #else
			    <td valign="top" id="header-avatar-image-container">
                     <IMG height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" src="$jemhUtils.inlineImage($jemhUtils.getImageUrl('AnonymousUserIcon'))" alt='$messageUtils.getMessage("velocity.macro.action.header.anonymous")'/>
                </td>
                <td id="header-text-container" valign="middle"> 
               	   $messageUtils.getMessage('velocity.macro.action.header.anonymous') 
                   <strong>$messageUtils.getMessage("velocity.macro.action.header.$jemhUtils.webhookEvent")</strong> $messageUtils.getMessage('velocity.macro.action.header.anIssue')
         		</td> 	   
                #end
           </tr> 
       </table> 
    </td> 
</tr>
#end

...

Jira theme
Code Block
#macro ( jemhIncludeBodyjemhIncludeStandardActionHeader)
<tr>
	    <td classid="emailheader-content-main mobile-expand  issue-description-container">
		<table class="text-paragraph-pattern">
			<tr>
				<td class="text-paragraph-pattern-container mobile-resize-text">
					#if ($jemhUtils.isCreateOrInChangeLog($context, 'description'))
						$jemhUtils.setFieldRendered()
						$jemhUtils.wikiToHtml($fields.description.textValue())
					#end
					#foreach( $comment in $jemhUtils.filterRestrictedComments($context.comments) )
						$jemhUtils.setCommentRendered()
						
						#if ($jemhUtils.isJiraUser($comment.author.name.textValue()))				<pre>#if($jemhUtils.hasUserRole($jemhUtils.getOperationUser(),'developers'))$messageUtils.getMessage('velocity.macro.action.header.support')#else$comment.author.displayName.textValue()#end $messageUtils.getMessage('commented'):</pre> 
						#end 
						$jemhUtils.wikiToHtml($comment.body.textValue())
						#if (!$jemhUtils.isNull($comment.visibility))($messageUtils.getMessage('restrictedTo') <span class="restricted-to-value">$comment.visibility.value.textValue()</span>) #end
						#if (!$jemhUtils.isNull($comment.updated) && $comment.created != $comment.updated)<span class="edited-label">$messageUtils.getMessage("velocity.macro.action.header.edited")</span> $messageUtils.getMessage("velocity.macro.action.header.by") $comment.updateAuthor.name.textValue()#end
						#if( $foreach.hasNext )<hr>#end
					#end
				</td>
			</tr>
		</table>
	</td>
</tr>            
pattern-container">
        <table id="header-pattern">
            #if ($jemhUtils.webhookEvent)
                <tr>
                    #set($authors = $jemhUtils.getChangelogAuthors())
                    #set($maxRenderedUsersCount = 1)
                    #foreach($user in $authors)
                        #if($foreach.count == $maxRenderedUsersCount)
                            #if ($user)
                                #if ("$jemhUtils.getUserAvatar($user,'32x32')" != "" )
                                    <td valign="top" id="header-avatar-image-container">
                                        <IMG class="image_fix" height="32" width="32" border="0"
                                             style="border-radius: 3px; vertical-align: top"
                                             SRC="$jemhUtils.getUserAvatar($user,'32x32')"
                                             alt='$jemhUtils.getUserDescription($user)'/>
                                    </td>
                                #end
                                <td id="header-text-container" valign="middle">
                                    <a class="user-hover" rel="$jemhUtils.getUserAccountId($user)" id="email_$jemhUtils.getUserAccountId($user)"
                                       href="$jemhUtils.getUserProfileUrl($user)">$jemhUtils.htmlEscape($jemhUtils.getUserDescription($user))</a>
                                </td>
                            #else
                                <td valign="top" id="header-avatar-image-container">
                                    <IMG height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top"
                                         src="$jemhUtils.getImageUrl('AnonymousUserIcon')"
                                         alt='$messageUtils.getMessage("velocity.macro.action.header.anonymous")'/>
                                </td>
                                <td id="header-text-container" valign="middle">
                                    <p>
                                        $messageUtils.getMessage('velocity.macro.action.header.anonymous')
                                    </p>
                                </td>
                            #end
                            #break
                        #end
                    #end
                <td class="header-text-container">
                    #if($authors.size() > $maxRenderedUsersCount )
                        #set($numberOftruncatedUsers = $authors.size() - $maxRenderedUsersCount)
                        &nbsp;$messageUtils.getMessage('velocity.macro.action.header.truncate.users', $numberOftruncatedUsers)
                    #end
                    <strong>&nbsp;$messageUtils.getMessage(
                        "velocity.macro.action.header.$jemhUtils.webhookEvent")</strong> $messageUtils.getMessage(
                    'velocity.macro.action.header.anIssue')
                    #if($jemhUtils.isCreatedByEmailUser()  && false)
                        <strong>$messageUtils.getMessage('velocity.macro.action.header.byEmail')</strong>
                    #end
                </td>
            </tr>
            #end
        </table>
    </td>
</tr>
#end
jemhIncludeBody Macro
Deprecated (old)
Code Block
#macro ( jemhIncludeBody)
<tr>
	<td class="email-content-main mobile-expand  issue-description-container">
		<table class="text-paragraph-pattern">
			<tr>
				<td class="text-paragraph-pattern-container mobile-resize-text">
					#if ($jemhUtils.isCreateOrInChangeLog($context, 'description'))
						$jemhUtils.setFieldRendered()
						$jemhUtils.wikiToHtml($fields.description.textValue())
					#end
					#foreach( $comment in $jemhUtils.filterRestrictedComments($context.comments) )
						$jemhUtils.setCommentRendered()
						
						#if ($jemhUtils.isJiraUser($comment.author.name.textValue()))				<pre>#if($jemhUtils.hasUserRole($jemhUtils.getOperationUser(),'developers'))$messageUtils.getMessage('velocity.macro.action.header.support')#else$comment.author.displayName.textValue()#end $messageUtils.getMessage('commented'):</pre> 
						#end 
						$jemhUtils.wikiToHtml($comment.body.textValue())
						#if (!$jemhUtils.isNull($comment.visibility))($messageUtils.getMessage('restrictedTo') <span class="restricted-to-value">$comment.visibility.value.textValue()</span>) #end
						#if (!$jemhUtils.isNull($comment.updated) && $comment.created != $comment.updated)<span class="edited-label">$messageUtils.getMessage("velocity.macro.action.header.edited")</span> $messageUtils.getMessage("velocity.macro.action.header.by") $comment.updateAuthor.name.textValue()#end
						#if( $foreach.hasNext )<hr>#end
					#end
				</td>
			</tr>
		</table>
	</td>
</tr>            
#end
Jira theme
Code Block
#macro ( jemhIncludeBody)
<tr>
    <td class="email-content-main mobile-expand  wrapper-special-margin">
        <table class=" text-paragraph-pattern keyvalue-table">
            #set ($comments=$jemhUtils.filterRestrictedComments($context.comments))
            #if($comments && $comments.size() > 0)
                <tr>
                    <th>
                        <h3>$messageUtils.getMessage('comments')</h3>
                    </th>
                </tr>
                #foreach( $comment in $comments )
                    $jemhUtils.setCommentRendered()
                    <tr>
                        #if ( !$comment.created.equals($comment.updated) )
                            <th>#userJemhIncludeStandardActionHeader($comment.author.accountId, $comment.updated, "email.comment.updated.header")</th>
                        #else
                            <th>#userJemhIncludeStandardActionHeader($comment.author.accountId, $comment.created, "email.comment.created.header")</th>
                        #end
                        <td class="text-paragraph-pattern-container mobile-resize-text">
                            #set ($timestamp = $comment.key)
                            #if ($jemhUtils.isPrivateJSDComment($comment)) <span class="aui-label">$messageUtils.getMessage('internal')</span> #end
                            $jemhUtils.wikiToHtml($comment.body.textValue())

                            #if (!$jemhUtils.isNull($comment.visibility))($messageUtils.getMessage('restrictedTo')
                                <span class="restricted-to-value">$comment.visibility.value.textValue()</span>
                                ) #end
                            #if (!$jemhUtils.isNull($comment.updated) && $comment.created != $comment.updated)
                                <span class="edited-label">$messageUtils.getMessage(
                                    "velocity.macro.action.header.edited")</span> $messageUtils.getMessage(
                                "velocity.macro.action.header.by") $jemhUtils.getUserDescription($comment.updateAuthor)#end
                            #if( $foreach.hasNext )
                                <hr>
                            #end
                        </td>
                    </tr>
                #end
            #end
            <tr>
                <td>
                    #renderApprovals()
                </td>
            </tr>
        </table>
    </td>
</tr>
#end
Generic theme
Code Block
#macro ( jemhIncludeBody)
<tr>
    <td class="email-content-main mobile-expand  wrapper-special-margin">
        <table class="text-paragraph-pattern keyvalue-table">
            #set($descriptionPresent = !$jemhUtils.isNull($fields) && !$jemhUtils.isNull($fields.description) && $fields.description.isTextual() && !$stringUtils.isBlank($fields.description.textValue()))
            #if ($descriptionPresent && $jemhUtils.isCreateOrInChangeLog($context, 'description'))
                $jemhUtils.setFieldRendered()
                <tr>
                    <h3>$messageUtils.getMessage('description')</h3>
                </tr>
                <tr class="issue-description-container">
                    <p>$jemhUtils.wikiToHtml($fields.description.textValue())</p>
                </tr>
            #end
            #set ($comments=$jemhUtils.filterRestrictedComments($context.comments))
            #if($comments && $comments.size() > 0)
                <tr>
                    <h3>$messageUtils.getMessage('comments')</h3>
                </tr>
                #foreach( $comment in $comments )
                    $jemhUtils.setCommentRendered()
                    <tr>
                        <th>
                            #if ( !$comment.created.equals($comment.updated) )
                                #userJemhIncludeStandardActionHeader($comment.author.accountId, $comment.updated, "email.comment.updated.header")
                            #else
                                #userJemhIncludeStandardActionHeader($comment.author.accountId, $comment.created, "email.comment.created.header")
                            #end
                        </th>
                    </tr>
                    <tr>
                        <td class="text-paragraph-pattern-container mobile-resize-text">
                            #if ($jemhUtils.isPrivateJSDComment($comment)) <span class="aui-label">$messageUtils.getMessage('internal')</span> #end
                            $jemhUtils.wikiToHtml($comment.body.textValue())
                            #if (!$jemhUtils.isNull($comment.visibility))($messageUtils.getMessage('restrictedTo')
                                <span class="restricted-to-value">$comment.visibility.value.textValue()</span>
                                ) #end
                            #if (!$jemhUtils.isNull($comment.updated) && $comment.created != $comment.updated)
                                <span class="edited-label">$messageUtils.getMessage(
                                    "velocity.macro.action.header.edited")</span> $messageUtils.getMessage(
                                "velocity.macro.action.header.by") $jemhUtils.getUserDescription($comment.updateAuthor)#end
                            #if( $foreach.hasNext )
                                <hr>
                            #end
                        </td>
                    </tr>
                #end
            #end
        </table>
        #renderApprovals()
    </td>
</tr>
#end
Warning

$jemhUtils.setFieldRendered() and $jemhUtils.setCommentRendered() mark the template as not empty. If you are adding a custom field to your template, remember to write $jemhUtils.setFieldRendered() otherwise you may see a 'email has not been sent as no useful information was set' warning.

...

  1. Go to Notifications -> Preview. Select the new Issue Created Template set named Issue Created: Issue Created Jira Support (User)

    Image RemovedImage Added
  2. Test the template sets with different preview contexts. Examples:

    Developer user creates an issue using UI
     

    Image RemovedImage Added


    User creates an issue via email

    Image RemovedImage Added


    Developer user comments an issue via UI

  3. Repeat steps using other template sets and preview contexts. 

...

  1. Go to Notifications -> Notification Mappings -> Email -> Pen

    Image RemovedImage Added

     

  2. Theme Changer, select JIRA Support (User). This action updates all events with the new theme's template sets.

     

  3. After submit, email notifications will use the new theme.

...