---
title: "Workflow Post Function"
canonical: "https://docs.getxporter.app/space/XPORTER/1412596/Workflow%20Post%20Function"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

## Introduction

[Xporter](https://marketplace.atlassian.com/apps/891368/xporter-export-issues-from-jira?tab=installation&hosting=datacenter) provides a [Workflow Post Function](https://confluence.atlassian.com/adminjiraserver/advanced-workflow-configuration-938847443.html) that allows administrators to define multiple actions that will be performed during transitions in Jira Workflows.  
The Xporter Post Function allows you to generate a document during transitions in Jira Workflows and to define which actions you want to perform.

## <span style="color: #000000">Access</span>

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> On your Jira instance, click the Settings/gear icon (Figure 1 - 1), and select *Issues *(Figure 1 - 2)*.*
> 
> ![Figure 1 - Access](media://ddfa2d68-794e-4f7a-bd3d-99e38c35aa16)
> 
> > Macro (rw-step)
> 
> On the left side menu, click *Workflows* (Figure 2 - 1).
> 
> ![Figure 2 - Workflows](media://03b3fbfa-e8de-437d-b469-299520114510)
> 
> Here you can:
> 
> - See the list of the active workflows (Figure 2 - 2).
> - Add a workflow (Figure 2 - 3).
> - Import a workflow (Figure 2 - 4).
> - View/edit/copy an existing Workflow (Figure 2 - 5).

## <span style="color: #000000">Operations</span>

### <span style="color: #000000">Xporter Post Function Configuration</span>

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> <span style="color: #000000">To </span>[<span style="color: #000000">configure the Xporter Workflow Post Function</span>](https://confluence.atlassian.com/adminjiraserver/advanced-workflow-configuration-938847443.html)<span style="color: #000000"> you must:</span>
> 
> - Select the [Template](https://docs.getxporter.app/space/XPORTER/1409467) to use (Figure 3 - 1).
> - Select the output format (Figure 3 - 2).
> - Provide the name of the file you want to generate (Figure 3 - 3).
> - Select if the [Xporter Post Function should have a Javascript condition](https://confluence.getxray.app/display/public/XPORTER/Workflow+Post+Function#WorkflowPostFunction-WorkflowPostFunctions:JavaScriptconditions) to be evaluated when this Workflow function is executed (Figure 3 - 4).
> 
> ![Figure 3 - Parameters](media://a2654a6d-7da0-427c-bb8b-c04fde1cc30e)
> 
> > ℹ️ If the **Include Attachments** option is turned on, the file will be generated with the Issue's attachments.
> 
> > ℹ️ The [mappings](https://docs.getxporter.app/space/XPORTER/1413922) that you can include are the same mappings that are used inside the Templates with the same notation.
> > ℹ️ 
> > ℹ️ You can also use the following Xporter format functions:
> > ℹ️ 
> > ℹ️ - [Fields with HTML](https://docs.getxporter.app/space/XPORTER/1413876)
> > ℹ️ - [Formatting Date Fields](https://docs.getxporter.app/space/XPORTER/1413867)
> > ℹ️ - [Formatting Number, Escaping and User Picker Fields](https://docs.getxporter.app/space/XPORTER/1413867)
> > ℹ️ 
> > ℹ️ You can't use JavaScript with these mappings.
> 
> > Macro (rw-step)
> 
> Once you're done, click the *Add* button (Figure 3 - 5).

### <span style="color: #000000">Actions Available on the Xporter Post Function</span>

The Xporter Post Function provides four different actions and each of them will have its own specifications.

The administrator will have the possibility to have more than one action configured to different receivers or to upload the document generated into multiple [File Servers](https://docs.getxporter.app/space/XPORTER/1409479).  
The filename can be modified on each action, and it can be specified a custom name. T<span style="color: #172B4D">he filename configuration has a size limit of 50 characters (but the exported file name doesn't have a limit).</span>

#### Attach File

The document generated can be attached to the Issue of who performed the transition (Figure 4).

![Figure 4 - Attach file](media://142fe041-bc52-4032-8762-387cc115f8d2)

#### Save on Jira Host

This action allows the administrators to save the report on the Jira machine.

![Figure 5 - Save on Jira host](media://6880ae20-d3b6-46f9-ad24-8b63e96fd97e)

> ℹ️ The path defined (Figure 6) will be accepted only if the SO user has permission to write on the respective folder.

####   
Send Email

Another important action is sending emails with attached reports or rendering a Template in the body of the Post Function.  
Enable the option to use the default body (Figure 6 - 1) and your Post Function will have the Template rendered.

![Figure 6 - Send email](media://1a886314-4e31-4a18-a596-165e25a6fe3d)

#### Upload File

Choose this action if you want to upload the generated document to a File Server.   
Pick the Server to which the exported file will be saved and after this, the administrator will have the opportunity to define the path on the filename. T<span style="color: #172B4D">he filename configuration has a size limit of 50 characters (but the exported file name doesn't have a limit).</span>

![Figure 7 - Upload file](media://6bc229a1-97e0-4bf9-9f92-27e09fe480ea)

### <span style="color: #000000">Xporter Post Function Overview</span>

After choosing all the actions that will be performed, Xporter will give you an overview of each action with a description and the filename. T<span style="color: #172B4D">he filename configuration has a size limit of 50 characters (but the exported file name doesn't have a limit).</span>  
You'll be able to edit (Figure 8 - 1) and/or remove (Figure 8 - 2) the existing actions according to your expectations.

![Figure 8 - Overview](media://473cb902-71e7-4275-98ad-9b582794e30e)

After the configuration process, the post functions of the transition will look like the screenshot below (Figure 9).

![Figure 9 - Jira server version](media://d229f562-7170-4381-8739-7a99a9fb5a97)

### <span style="color: #000000">Workflow Post Functions: JavaScript Conditions</span>

#### Overview

Xporter supports the evaluation of JavaScript conditions to check if the Workflow Post Function should be executed on that specific Jira transaction.

> ❌ Be careful with dangerous JavaScript expressions. For example, watch out for infinite loops or high-computation expressions. This will make Jira take up a lot of your CPU and you <span style="color: #003366">might have to restart it</span>.
> ❌ 
> ❌ This feature is currently only available in Xporter Server version.

#### Configuration

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Activate the Condition option (Figure 10 - 1) in both Post Functions.
> 
> ![Figure 10 - Configuration](media://964cd7d7-4c5f-477d-bf79-97f9e02ef42c)
> 
> > Macro (rw-step)
> 
> Write your JavaScript condition in the text box (Figure 10 - 2). If you activate this option, your Post Function will only be executed if the JavaScript expression is evaluated to be a *True* statement.
> 
> > Macro (rw-step)
> 
> Use the Mappings the same way you use them in Xporter Templates.
> 
> ![Figure 11 - Mappings](media://82b7cfa8-10d0-43bd-ab65-3bf2fcd08a22)
> 
> For this example, every time you make Status transaction on an Issue, Xporter will check if the Issue Key is "TEST-1" and if it is, it will execute this Post Function.


<details>
<summary>Support/Troubleshooting</summary>

If you have questions or technical issues, please [contact the Support team via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) or [send us a message using the in-app chat](https://docs.getxporter.app/space/XPORTER/23102936).
</details>