# Workflow post functions

Email This Issue has workflow post functions to send fully customizable emails as part of the workflow transitions. Sending emails from transitions can be a better alternative to event notifications, because specific operations, such as **Request Approved** might not be precisely represented by generic event types such as **Issue Updated**.

To see the list of current post functions, go to the **Outgoing Mails** configuration tab and select **Workflow Post Functions** under **GENERAL CONFIGURATION**.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FWWMtfZZ1c3cl3PzUeHLu%2Fpost_function_1.png?alt=media&#x26;token=7b119e17-9a25-4f2a-bf5a-1e1ceaa4efce" alt=""><figcaption><p>Workflow Post Functions</p></figcaption></figure>

## Adding a post function to the workflow

Email post functions must be added and edited in the workflow editor of Jira.&#x20;

1\. Select **Issues** in the **Settings** menu, then go to **Workflows** under the **WORKFLOWS** section of the sidebar.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2Fl7qxv9EENMHYxoMgzvlr%2Fpost_function_2.png?alt=media&#x26;token=ecc1ca0f-2954-4460-ad4a-8cb439d50f6c" alt=""><figcaption><p>Select Issues in Settings</p></figcaption></figure>

2\. Choose the workflow that you want to add the post functions to and click **View** under the **Actions** column.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2Fqm4bB5FNrYW7gyaZKZhn%2Fpost_function_3.png?alt=media&#x26;token=04213b2a-8c7e-4470-9f62-b3bbc959f351" alt=""><figcaption><p>View Workflow Postfunctions</p></figcaption></figure>

3\. Switch to **Text** view to display the **Transitions (id)** column, then click on the chosen transition.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2F05NqsBBI8p5f0aL3jpBG%2Fpost_function_4.png?alt=media&#x26;token=454096d4-86eb-4fd1-a6f0-dba5e772e5ad" alt=""><figcaption><p>Workflow Text View</p></figcaption></figure>

&#x20;4\. Switch to the **Post Functions** tab of the selected transition and click **Add post function**.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2F9wRHh9YJFQrQKzbwtE3Q%2Fpost_function_5.png?alt=media&#x26;token=971b358f-026d-4f97-a978-41eefcf89307" alt=""><figcaption><p>Transition Management</p></figcaption></figure>

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2Fc2z8ofuGbtuqYskXbcj1%2Fpost_function_6.png?alt=media&#x26;token=12a75323-755f-411d-8cb7-5e2f57265aa0" alt=""><figcaption><p>Choose Customizable Emails</p></figcaption></figure>

Consider the following during setting up a post function:

* **Scope -&#x20;*****WHEN***&#x20;
* **Recipients -&#x20;*****WHO***&#x20;
* **Content Settings -&#x20;*****WHAT***&#x20;

### **Setting up Scope -&#x20;*****WHEN***&#x20;

Setting a JQL filter makes it easy to better target the issues and send emails conditionally depending on the issue fields. The following example emails are sent only when the issue is of the **Highest** priority.

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FDzYPyTEQad36b2tpEe1m%2Fpost_function_7.png?alt=media&#x26;token=33ecffa3-0fbd-44f8-9770-c936f42d875e" alt=""><figcaption><p>Scope - WHEN</p></figcaption></figure>

To enter a JQL that involves a user name (such as defining the assignee of an issue), follow these steps:

1. Under the **JQL Filter** field, click **Edit**.
2. Enter the JQL filter.
3. When it comes to entering a user name, do the following:
   1. &#x20;Click **Insert user**.&#x20;
   2. Search for the user name, then click **Insert** to insert a string.
4. Click **Save** to use the JQL filter or **Cancel** to delete it.

### Setting up Recipients - *WHO* <a href="#workflowpostfunction-recipients" id="workflowpostfunction-recipients"></a>

Recipients selected in the post function will receive the emails.

Emails can have **To**, **Cc** and **Bcc** recipients. For all of these recipient types, you can enter or select:

* Users from Jira
* Email addresses
* Users related to the issue or project, such as:
  * **Assignee**
  * **Reporter**
  * **Watchers**
  * **Project Lead**
  * **Me** (current user)
* Project roles
* User groups
* Custom fields that hold email addresses or users or groups

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FsIfcmvpM4bXpS0YfyDIZ%2Fpost_function_8.png?alt=media&#x26;token=7f5d5829-fed1-4856-8452-f5fda1ad6ebe" alt=""><figcaption><p>Recipients - WHO</p></figcaption></figure>

### Setting up Content Settings - *WHAT* <a href="#workflowpostfunction-contentsettings" id="workflowpostfunction-contentsettings"></a>

Content settings in Email This Issue Post Functions specify the [email template](https://docs.meta-inf.hu/email-this-issue/outgoing-emails/email-this-issue-for-jira-cloud-customizable-email-templates) to use, and additional content that will be added to the email.

Content settings attributes include:

| **Template**     | An Email This Issue template          | The template selected here will be used to render the subject and body of the final email.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ---------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Subject**      | Text to be added to the email subject | <p>Text entered here is combined into the final email's subject using the template above.</p><p>The template's <code>$!mailSubject</code>  variable renders the entered value in the email subject.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **Message**      | Text to be added to the email body    | <p>Text entered here is combined into the final email's body using the template above.</p><p>The template's <code>$!mailBody</code> variable renders the entered value in the email body.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **Attachments**  | Attachment policy                     | <p>The value selected in this field determines which issue attachments should be attached to the email.</p><p>The options are the following:</p><ul><li><strong>all</strong>: all attachments added</li><li><strong>none</strong>: none of the attachments added</li><li><strong>added in the last operation</strong>: attachments added as part of the operation that fired the event (e.g. Edit Issue)</li><li><strong>newest versions of all</strong>: newest version of all attachments. Attachments with the same name are considered to be versions of the same attachment.</li><li><strong>added recently</strong>:  the latest added attachments. </li></ul><p><strong>Note</strong>: Jira Email This Issue doesn't receive any list about the added attachments. To figure out the latest added attachment, Jira Email This Issue asks for all the attachments of the issue and send only added at the last minute from the latest one.</p><ul><li><strong>the newest attachment(s) in the issue</strong>: the last added attachment(s)</li></ul><p>You can configure the policy to filter internal attachments. When this option is enabled and the issue is in a Service Management project, attachments added in internal comments won't be included in the email.</p> |
| **Email Format** | HTML or TEXT                          | The format of the email.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FnOGHAwaRHG3tALoCiDrp%2Fpost_function_9.png?alt=media&#x26;token=d56cc897-30d4-430f-989d-6912e020e323" alt=""><figcaption><p>Content Settings - WHAT</p></figcaption></figure>

{% hint style="info" %}
**Note**: It is perfectly valid to add multiple Email This Issue post functions to the same transition; they will be called one after the other.
{% endhint %}

{% hint style="warning" %}
**Important**: Post functions must be moved down before or after the function firing the event. This is needed because Email This Issue expects the issue to be updated and fully indexed before rendering issue fields in the email.
{% endhint %}

<figure><img src="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FbeKElkA61C8dvEvVhqd5%2Fpost_function_10.png?alt=media&#x26;token=5dea0e78-2f61-44ac-b7de-2e3b0c548471" alt=""><figcaption><p>Post Functions on Transition</p></figcaption></figure>
