It's worth noting from the outset that although you may be familiar with extensions to workflows in the Jira Server version of ScriptRunner, the Cloud infrastructure differs. 

You can use workflows in Jira Cloud to change, or transition, an issue through a set of logical steps. Workflows typically represent a process and contain a set of statuses and transitions. Workflow extensions enable you to set up rules relating to the transition of an issue's status within Jira Cloud, giving you increased control over how and when an issue transitions. You can also set up post-transition rules.

You can extend workflows by adding:

  • Post Functions - perform automated actions after an issue transitions to a new status.

  • Conditions - check to make sure that a requirement is met before the transition option is available.

  • Validators - check to make sure that a requirement is met when a user tries to transition an issue.

Example Workflow Extension

To access ScriptRunner for Jira Cloud workflow extensions, click the Cog icon to open the Settings menu and select Issues. You will see a list of Jira issues displayed and a sidebar menu containing a Workflows option.

Once opened, a list of Active and Inactive workflows are displayed along with several other options that enable you to work with ScriptRunner for Jira Cloud workflow extensions in a number of ways. These include:

  • Add workflow - Enter a name and description for the workflow and click Add to create a new workflow. 
  • Import from Marketplace - Click to import a workflow from the Atlassian Marketplace.
  • View - Click to view your chosen workflow.
  • Edit - Click to open your chosen workflow and make edits as required.
  • Copy - Click to copy your chosen workflow which you will need to rename.

By way of example, if you would like to add a Condition, follow the steps below:

  1. Click Edit for your chosen workflow. The workflow opens with the Diagram view displayed as default. You can switch to Text view if preferred.
  2. Select a transition from within the Diagram view. An example of a transition might include Screening or Interviewing for a recruitment workflow. A list of associated workflow functions is displayed for the selected transition including Conditions, Validators, Post Functions, Triggers, and Properties. You can also click the Add Status or Add Workflow buttons to create new options.
  3. Click the workflow function type you wish to add/edit, for this example we will choose Conditions. The Transition screen shows a list of all conditions set up for this transition.
  4. Click Add Condition. Under Add Condition to Transition a list of available conditions is shown.
  5. Select the ScriptRunner Script option from the menu and click Add.