A post function is a workflow function that performs automated actions after an issue transitions to a new status. ScriptRunner has several built-in post functions. Each function contains a condition that can be used to dismiss the rest of the script if it returns false. Most functions also have additional code that can execute to modify the final action of the function.
There are several ways to enhance your workflow using post functions, including:
Automatically add or remove an issue from the active sprint after it is transitioned.
Change the assignee of an issue after it’s transitioned.
Send a notification on the transition of an issue.
Create Post Function
For help navigating to ScriptRunner workflow functions, follow the steps in the Example Workflow Extension.
- Select the transition you wish to add the post function to.
- Click Post Function→Add Post Function.
- Select the ScriptRunner Post Function option then Add.
- Select a post function from the list of available functions. For example Add/Remove From Script.
- In the Description field, enter a short description of the post function.
- Select Enable Post Function to enable it as soon as it is added.
Different options are available depending on the post function added, see the examples for each post function in this section for field descriptions along with Additional Code.
Edit Post Function
- Navigate to ScriptRunner → Workflows. All existing workflows are displayed as default.
- Select Post Function from the Type drop down list. You will now see a refined list displayed.
- Click the Actions ellipsis for your preferred workflow and select Edit.
- Edit the post function fields and click Save.
Post Function Limitations
Post functions in ScriptRunner for Jira Cloud are implemented as asynchronous webhooks. This means that:
Post functions cannot cancel a transition.
- The issue may be displayed to the user before all the post functions have executed. ScriptRunner attempts to indicate to the user that the issue has been updated in the background, but this is not guaranteed.
Ordering of post function execution is not defined (you cannot have one post function rely on the output of another).
If you add a post function for creating a transition then it must be ordered below the post function named 'Re-index an issue to keep indexes in sync with the database' to ensure the issue gets created before the post function runs.
An epic post function can be cloned, however, the issues contained within that epic are not cloned. You will, therefore, need to recreate any associated issues.