Configure Email Approval
Read this tutorial if you want to implement email approval, i.e. request email recipients to give you feedback or make decisions on issues (e.g. approve or unapprove orders) via email replies.
Email approval requires multiple components in Email This Issue configured properly.
- Email template to send out request for decision to approvers
- Mail Handler to process approvers' replies
- Workflow transitions for each decision types, e.g. to Approve, Unapprove, etc
- Field Rules to parse email content and find the decision tag to call the appropriate workflow transition
Configure Email Template
Email Templates are powerful means to create eye candy emails with content your like, including custom fields, issue links, comments, previous email conversation etc.
There is a dedicated step-by-step general tutorial to customize an email template: Customize the Template Used by Email Button.
Here we detail what you need to support decision making or approval.
Add links to the email template to represent each decisions
- it must be a "mailto:" type of link
- To Approve and Unapprove add this:
- "<a href="mailto:email@example.com?subject=$!issue.key - Decision: Approved">Approve</a>"
- "<a href="mailto:firstname.lastname@example.org?subject=$!issue.key - Decision: Unapproved">Unapprove</a>"
- These links will be shown in the email client as part of the email
- Users will be able to click them, and generate a response email with subject containing the issue key and the words Approved or Unapproved respectively.
Use this template to send the approval request email to the approvers. It is good practice to select the approvers (decision makers, etc) in a multi user custom field and send the email with this custom field as a recipient.
Configure Mail Handler
Here we detail what you need to do to support approval by email.
When you configure the mail handler, make sure that "Execute workflow transition" and "Initialize Fields" checkboxes are checked.
Configure Workflow Transitions
Your workflow must be prepared to support decision making.
There must be a transition for each possible decisions you want to support.
e.g. add two transitions called "Approve" and "Unapprove" to a status you like e.g. "Approval in progress".
Configure Field Rules
Field Contexts and Field Rules allow you to manipulate issues and issue fields based on email content.
What you need to do is a field rule to extract the decision information from the email content. Below is an example that extracts this from Email Subject:
- Add a Field Rule with the following attributes:
- Goal: Execute workflow transition
- Regular Expression: (?i)Decision: (.*)
- Match in: Email Subject
- Value from: Capture Group 1
- Order: 1
- Optionally you may want to store the approvers / unapprovers who already replied in a multi user picker field, to do this add a field rule:
- Goal: Set Fields in Existing Issues
- Regular Expression: .*
- Match in: Sender Email Address
- Value from: Capture Group : whole expression
- Issue Field: select a multi user picker field, e.g. something called "Already Replied"
- Order: 1