Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add Workflow Buttons to Velocity Email Templates?

Edwin Chung April 24, 2014

Does anyone have any idea how to do this?

We'd like it if there were workflow-buttons included in an email template. Wouldn't it be great if I could "Resolve" or "Open" an issue directly from the HTML email I receive from JIRA?

Ed

2 answers

1 accepted

0 votes
Answer accepted
Edwin Chung May 11, 2014

Thanks Fabio.

I'm not adept enough with the Apache Velocity to do like you suggested, but I went ahead and "hard coded" my results.

I use the file at WEB-INF\classes\templates\email\html\includes\patterns\comment-action.vm -- this is the piece that adds the Comment link at the bottom of almost all outgoing JIRA notifications. I made some "if - elseif - end" loops to add the links based on the Status Name:

#disable_html_escaping()

#set ($commentActionText = "${i18n.getText('jira.mentions.email.comment.add')}")

#* @vtlvariable name="attachmentsManager" type="com.atlassian.jira.mail.util.MailAttachmentsManager" *#

<table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%">

    <tr>

        <td id="actions-pattern-container" valign="middle">

            <table align="left">

                <tr>

                    <td class="actions-pattern-action-icon-container">

                        Status: ${issue.getStatusObject().getSimpleStatus().getName()} -  

                    </td>

#if(${issue.getStatusObject().getSimpleStatus().getName()} == "New")

<td class="actions-pattern-action-icon-container">

<a href="${baseurl}/secure/WorkflowUIDispatcher.jspa?id=${issue.getId()}&action=4" target="_blank">Acknowledge</a> | 

</td>

<td class="actions-pattern-action-icon-container">

<a href="${baseurl}/secure/WorkflowUIDispatcher.jspa?id=${issue.getId()}&action=1101" target="_blank">Stall</a> | 

</td>

<td class="actions-pattern-action-icon-container">

<a href="${baseurl}/secure/WorkflowUIDispatcher.jspa?id=${issue.getId()}&action=5" target="_blank">Resolve</a> | 

</td>

<td class="actions-pattern-action-icon-container">

<a href="${baseurl}/secure/WorkflowUIDispatcher.jspa?id=${issue.getId()}&action=1091" target="_blank">Reject</a> | 

</td>

#elseif(${issue.getStatusObject().getSimpleStatus().getName()} == "Stalled")

<td class="actions-pattern-action-icon-container">

<a href="${baseurl}/secure/WorkflowUIDispatcher.jspa?id=${issue.getId()}&action=1121" target="_blank">Resume</a> | 

</td>

<td class="actions-pattern-action-icon-container">

<a href="${baseurl}/secure/WorkflowUIDispatcher.jspa?id=${issue.getId()}&action=5" target="_blank">Resolve</a> | 

</td>

 #end

                    <td class="actions-pattern-action-text-container">

<a href="${baseurl}/browse/${issue.getKey()}#add-comment" target="_blank"><img class="actions-pattern-action-icon-image" src="$attachmentsManager.getImageUrl("/images/mail/comment-icon.png")" alt="$commentActionText" title="$commentActionText" height="16" width="16" border="0" />Comment</a>

                    </td>

                </tr>

            </table>

        </td>

    </tr>

</table>

0 votes
Fabio Racobaldo _Herzum_
Community Champion
April 24, 2014

Hi Edwin,

I did it in the past, you can update email template and embed in a button "resolved" or whatever you want. Each button should run a function that call the following REST service

/rest/api/2/issue/{issueIdOrKey}/transitions

Here Rest Api documentation : https://docs.atlassian.com/software/jira/docs/api/REST/latest/

Here, email template update way : https://confluence.atlassian.com/display/JIRA/Customizing+Email+Content

Hope this helps,

Fabio

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events