Skip to main content

Add a post function

Put a Scripted Post-function on a transition so that your script runs every time a work item moves through it.

Applies to: Script Master for Jira Β· Cloud

Before you begin​

  • Jira permission: Jira admin (the Administer Jira global permission).
  • A Jira admin has set up the Companion App. See Set up the Companion App.

Add the post function​

  1. Go to Settings > Work items > Workflows. In the workflow's row, select β‹― > Edit.

  2. Select the transition. Its rules panel opens.

  3. In the rules panel, select Add perform actions rule.

  4. Select Scripted Post-function, then Select. The Script Master editor opens in the dialog.

    Jira's rule type picker with Scripted Post-function selected

  5. In Backend JavaScript, write the script. To start from an example, copy one from Snippets and paste it into the editor.

    The post function editor with the Backend JavaScript editor, Snippets and the Test with Issue switch

  6. Optional: run the script against a work item. See Test a post function.

  7. Select Add, then Update workflow to publish the change.

Result: The script runs after every move through the transition. Its runs appear under Recent runs when you open the post function again, and on the Workflows tab.

Change a post function​

  1. Open the workflow in the editor as above, and select the transition.
  2. In the transition's rules panel, select the post function's card. The Edit Rule dialog opens on the Summary tab: This scripted workflow extension is configured, and the script looks excellent. Select expand to see the script.
  3. Select the Edit tab, and change the script.
  4. Select Update, then Update workflow to publish the change.

If someone changed the script outside Script Master since its last save there, the editor shows Changed outside Script Master. When you save, Script Master records the current script as a new version.

To go back to an earlier version, select Version history. See Version history.

A post function with no script yet shows Needs setup on the Workflows tab and does nothing.