Post functions are a powerful asset in the Jira automation toolset and allow you to automate processes after an issue has been transitioned. This can significantly accelerate your workflows and save you and your team from wasting time on admin work and data entry.
However, there is such a thing as having too many post functions. If you stack the deck too high, they can slow down your instance and make debugging a nightmare. If a single transition can result in a dozen complex post functions being launched, for example, then it can be tough to untangle the web of connected events and establish the key actions that are really required.
In this guide, I’ll cover how to add and remove post functions, our best practice recommendations for using them (and how many post functions is too many), and apps that can enhance automation in Jira.
Jira Post Functions Explained
Post functions are an invaluable tool in Jira for automating steps following transitions. Post functions can carry out tasks like updating fields in issues, updating an issue’s change history, adding comments, and triggering email notifications. You can also set rules so that post functions will only be executed if specific criteria are met.
Every Jira transition includes several essential post functions, which are performed in a set order. These post functions are crucial for the workflow to function, so they should not be changed, deleted, or reordered (and doing so will result in problems with other automations and integrations). You can add post functions between them and after them, however.
The built-in post function flow runs through the following items:
- Changing the work item’s status (based on the workflow’s rules)
- Adding a comment to the work item (if the user enters one during the transition)
- Updating the work item’s change history
- Re-indexing the work item to keep indexes synchronised
- Executing a Generic event that can be processed by notification listeners (which can trigger email notifications)
To note, notifications aren’t triggered until the very end of the transition, so the functionality may work slightly differently than you might expect.
Adding and removing post functions in Jira Cloud is fairly simple. At a broad level, you’ll need to edit the relevant workflow, select the relevant transition, and then select “Post functions” to access the options for the transition.
Here are step-by-step instructions for adding a post function:
- Select the cogwheel/settings symbol from your dashboard
- Click on “Work items”
- Go to “Workflows”, and click on “Edit” for the desired workflow
- Click on the relevant transition (click on the transition arrow from diagram mode, or select the transition in the “Transitions (id)” column in text mode)
- Next, go to the “post functions” tab (click on the “Post functions” tab in text mode, or click on “Post functions” in the properties panel in diagram mode)
- Click “Add post function” (see the list below for all the options available to you)
- Set the relevant parameters for your post function, and once you’re done, click “Publish Draft” to save the new post function
You can edit and remove post functions (and reorder them) from the same page, with the options on the right of the tab.
Here’s a list of all the post functions that can be added to transitions:
- Assign to current user
- Assign to lead developer
- Assign to reporter
- Clear field value
- Copy value from other field
- Set work item security level based on user’s project role
- Trigger a webhook
- Update work item custom field (including Assignee, Description, Environment, Priority, Resolution, Summary, Original Estimate, and Remaining Estimate)
Initial Transition Post Functions
All workflows include an initial transition, called “Create” or “Create work item” (depending on whether it’s a blank workflow or has been copied from the system workflow), and you can attach post functions to this. This allows you to perform operations when work items are created in the workflow.
The initial transition includes two essential post functions (that shouldn’t be edited, deleted, or reordered), which are to create a work item, and to fire an event that can then be processed by listeners. In addition to the standard set of post functions, you can add the following to the initial transition:
- Create comment
- Update work item status
- Store work item (storing updates)
Jira Post Functions Best Practice
Does your Jira workflow have too many post functions? Based on our experience, we recommend adding no more than 10 to 15 simple post functions to a workflow, and no more than five complex post functions.
Adding more than this generally builds an excessive level of complexity into the system and is likely to slow down your instance.
Apps to Assist Post Function Automation in Jira
While Jira comes with plenty of automation options, there are several apps available in the Atlassian Marketplace that enable you to do even more. Here are some of the top options.
ScriptRunner
The ScriptRunner app enables advanced automation and customisation in Jira via scripts. It also provides you with more information and control when it comes to post functions. The app includes ready-to-use post functions and you can also set up your own custom post functions.
ScriptRunner post functions include:
- Add/remove the issue from the sprint
- Add the current user as a watcher
- Archive the issue
- Assign to the last member with a specified role (or the first member with a specified role)
- Clear a field(s)
- Clone the issue and links
- Add a comment to the issue
- Copy field values
- Create a sub-task
- Fast-track transition the issue
- Fire an event (when conditions are met)
- Post a message to Slack
- Transition the parent issue when all sub-tasks are resolved
- Send a custom email
- Set the issue security level depending on specified conditions
- Add a comment to linked issues when the issue is transitioned
- Custom script post function
Using these features, when an issue was transitioned to the “Done” status, you could simultaneously close all sub-tasks attached to it, add a comment to all the issues linked to it, and post a message to Slack on the update.
ScriptRunner for Jira is available in the Jira Marketplace.
Workflow Enhancer for Jira
Workflow Enhancer for Jira enables you to use advanced validators, conditions, and post functions to boost automation in your workflows.
Notably, it allows you to trigger any Jira REST API following transitions. You can also deploy universal post functions, define variables, write to the application log, and use variables from the post function event payload. This gives you granular control over post functions and allows you to manage dependencies and convey logging and data precisely to your requirements.
In practice, this allows you to do things like adding comments to transitioned issues and logging information in custom fields, which could be used for saving details like error types and affected services.
Workflow Enhancer for Jira is available in the Jira Marketplace.
Automation for Jira
The Automation for Jira app enables you to extend your use of Jira automation, without any scripting or code, and you can create a wide range of automation rules.
Within its schema, you can set up the following automated actions:
- Create an issue, delete an issue, archive an issue, edit an issue, assign an issue, clone an issue, or transition an issue
- Comment on an issue or delete a comment
- Create sub-tasks
- Link issues
- Add a Service Desk customer or create a Service Desk request
- Create a variable or a version
- Delete attachments
- Log an action or work
- Lookup issues
- Manage watchers
- Publish an event
- Re-fetch issue data
- Release a version
- Send an email
- Send a Hipchat message, Microsoft Teams message, Slack message, Stride message, or Twilio (SMS) message
- Send an outgoing web request
- Set an entity property
- Trigger third party actions
Using these tools, you could set an issue for final review before it was marked as being completed by assigning it to a manager, adding a timestamp on the issue as a comment, sending an update via Teams and email, and logging the changed status in a third-party scheduling tool.
Automation for Jira is available in the Jira Marketplace.
Conclusion
Post functions are a great tool for automating your workflows and can significantly enhance how you track and manage work. If they’re overused, though, they can slow you down. Based on our experience, we recommend keeping your workflows lean and maintainable – and we’re confident that your Jira installation, and your team, will thank you for it.
How many post functions do you usually allow in a single transition? Let us know, get in touch!