How display issue type icon in email?

Shah Baloch February 21, 2022

I created a schedule that pulls high-priority issues that have not been updated in two days and it will send the list of the issues to the assignees via email. However it does not include issue-type icons, it is just sending issue types' names. Is there a way to include issue-type icons?

{{#issues}}
<tr>
<td>{{key}}</td>
<td>{{issueType.name}}</td>
<td>{{summary}}</td>
<td>{{status.name}}</td>
<td>{{assignee.displayName}} &emsp; </td>
<td>{{updated.format("MM/dd/yyyy")}}</td>
</tr>

automation_02212022.JPG

Any idea how to include icons?

Thank you

4 answers

1 accepted

2 votes
Answer accepted
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 3, 2022

There may be a better solution, but I'll suggest an approach I'd use to solve this.

I see you're using Jira Server, which I don't have access to. I'll show my work here for a Jira Cloud solution, and you can replicate the effort to find what works for you.

I'd start by investigating the URLs that Jira uses to display the issue type icons of interest. After all, they are just image files that all your Jira users already can access.

In the Chrome browser, I can right-click on an icon and use "Open image in new tab". Doing this on an issue type icon in Jira will reveal a URL to that icon. In my Jira Cloud instance for an Epic issue type icon, I see:

https://xxx.atlassian.net/images/icons/issuetypes/epic.svg

I was able to replace "epic" with "story" and "subtask" in my instance and see the right icons.

Based on this, I created a test rule which replicated part of your table:

Screen Shot 2022-03-03 at 10.44.17 AM.png

This simply maps {{issueType.name}} to all lowercase letters and embeds it in the URL for the icon. Here's a text version of that magic line above (for easier copy/paste):

<td><img src="https://xxxx.atlassian.net/images/icons/issuetypes/{{issueType.name.toLowerCase()}}.svg"/></td>

Testing my rule showed me this in an email:

Screen Shot 2022-03-03 at 10.47.32 AM.png

I can't explain the odd border on the first icon. Hopefully it looks normal for you.

_ _ _ _ _ _ _

A few additional notes about this approach:

  • Reminder: the URLs shown here might differ from what your Jira instance uses for issue type icons. You'll have to discover what URLs to use for your Jira.
  • In my Jira Cloud instance, some of my icons came back with a different URL path like:
    xxx.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium
    which I ended up ignoring. Instead I hacked the "nice" URL that I found for one icon to make that URL format work for all the icons of interest.
  • An assumption in this solution is that that the {{issueType.name}} perfectly maps to the icon names in your instance. That assumption may not hold for all issue types in your instance. In that case, you'll need a different approach. Instead of a single smart value expression using toLowerCase(), you'll need a series of conditionals like the following example:
 <td><img src="http://xxx.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/{{if(equals(issueType.id,10000))}}10315{{/}}{{if(equals(issueType.id,10001))}}10312{{/}}?size=medium"/></td>

This is ugly, and a bit brittle. But it'll work!

Shah Baloch March 7, 2022

@Mykenna CepekI was able to view icons by using https://myjira.com:8080/images/icons/issuetypes/task.svg.

I used the first method, the below code:

<td><img src="https://myjira.com:8080/images/icons/issuetypes/{{issueType.name.toLowerCase()}}.svg"/></td>

it didn't display the icons. It displays image missing icons, here is the screenshot:

automation_03072022_01.JPG

 

I did right click and selected "Download Pictures" from outlook, it still didn't display icons. it displayed the below icons:

automation_03072022_02.jpg

I was not sure about the second method because of those two numbers 10000 and 10315. Are these avatar ids? Where I can find it? I found the below code when I right-clicked on the task icon from the issue type and went to inspect.

<img src="https://myjira.com:8080/secure/viewavatar?size=xsmall&amp;avatarId=11218&amp;avatarType=issuetype" height="16" width="16" border="0" align="absmiddle"">

 

Thank you for your help.

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2022

If you can view the task.svg icon in your browser but not in an Outlook email, that sounds like it might be an Outlook thing. More on that later...

The second method I showed is using two numerical values, and it may be confusing. In my example, 10000 and 10001 are what Automation sees for {{issueType.id}}, so you can output those to the Automation Audit Log to see what those values are in your Jira Server instance for each Issue Type.

In my example for the second method, the numbers 10325 and 10312 are the avatarId values. So use those when constructing the URL in the conditionals. You'll also want to change the URL to match what you see when you right-click and inspect the task icon (rather than using what I posted).

Sounds like you've got the right approach. Just fuss with those details. If the URL looks right, but Outlook isn't showing it, maybe talk to a coworker who has worked with HTML in email at your workplace. Maybe the Jira base URL needs to be added to an Outlook whitelist so it can be treated as a safe source for images? Just a wild guess. 

Like Shah Baloch likes this
0 votes
Barnaby Falls September 20, 2023

Is there a way to include the issueType icon in a Slack message? 

0 votes
Boris Berenberg - Atlas Authority
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2022

If you're open to using a tool other than Automation, we support issue type icons in Notification Assistant for Jira.

0 votes
Josh Costella
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2022

Not sure if this will work... haven't tried but maybe try:

<td>{{issueType.icon}}</td>



OR


<td>{{issueType.avatar}}</td>
Shah Baloch February 24, 2022

Thank you @Josh Costella for your response. Unfortunately, it didn't work. Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events