Conditions

A script condition is a workflow condition that allows you to extend the functionality you find in a basic Jira workflow condition. A condition checks to make sure that a requirement is met before you can transition an issue. If the script returns false the transition button is not available for an issue until the condition is met.

There are several ways to enhance your workflow using script conditions, including:

  • Allow a transition only if the summary starts with specified characters.

  • Restrict transitions if certain fields are not present.

  • Enforce that the issue must have at least one PDF file attachment to transition.

  • Allow only certain users to transition an issue.

ScriptRunner for Jira Cloud provides workflow conditions using the Jira Expression Framework. It is not possible to use the REST API.

Navigate to Context Variables to see the variables provided by this framework that can be used to create expressions. Click the variables to view the properties that can be called.

Create Condition

For help navigating to ScriptRunner workflow functions, follow the steps in the Example Workflow Extension

  1. Select the transition you wish to add the condition to.

  2. Click Conditions→Add Condition.

  3. Select the ScriptRunner Script option then Add.

  4. Enter the Name of ScriptRunner Script Condition.

  5. In the ScriptRunner Script Condition field, enter the script condition expression. This script condition must be written as a Jira expression.

Edit Condition

  1. Navigate to ScriptRunner → Workflows. All existing workflows are displayed as default.
  2. Select Condition from the Type drop down list. You will now see a refined list displayed.
  3. Click the Actions ellipsis for your preferred workflow and select Edit.
  4. Edit the condition and click Save.