Restricting the availability of workflow transitions

Workflow transitions, by default, are accessible to anyone who has access to the issue. There will be times when you would want to restrict access to certain transitions. For example, you might want to restrict access to the Move to Backlog transition for the following reasons:

  • The transition should only be available to users in specific groups or project roles
  • Since the transition is a global transition, it is available to all the workflow statuses, but it does not make sense to show the transition when the issue is already in the Backlog status

To restrict the availability of a workflow transition, we can use workflow conditions.

Getting ready

For this recipe, we need to have the JIRA Suite Utilities add-on installed. You can download it from the following link or install it directly from the Universal Plugin Manager:

https://marketplace.atlassian.com/plugins/com.googlecode.jira-suite-utilities

How to do it…

We need to create a new custom field configuration scheme in order to set up a new set of select list options:

  1. Select and edit the workflow to configure.
  2. Select the Diagram mode.
  3. Click on the Move to Backlog global workflow transition.
  4. Click on the Conditions link from the panel towards the right-hand side.
  5. Click on Add condition, select the Value Field condition (provided by JIRA Suite Utilities) from the list, and click on Add.
  6. Select the Status field for Field, != for Condition, Backlog for Value, and String for Comparison Type.
  7. Click on the Add button to complete the condition setup.
  8. Click on the Add condition again and select User in the Project Role condition.
  9. Select the Developer project role and click on Add.
  10. Click on Publish Draft to apply the change.

Refer to the following screenshot:

How to do it…

After you have applied the workflow conditions, the transition Move to Backlog will no longer be available if the issue is already in the Backlog status and/or the current user is not in the Developer project role.

There's more…

Using the Value Field condition (that comes with the JIRA Suite Utilities add-on) is one of the many ways in which we can restrict the availability of a transition based on the issue's previous status. There is another add-on called JIRA Misc Workflow Extensions, which comes with a Previous Status condition for this very use case. You can download it from https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions.

When you have more than one workflow condition applied to the transition, as in our example, the default behavior is that all conditions must pass for the transition to be available.

You can change this so that only one condition needs to pass for the transition to be available by changing the condition group logic from All of the following conditions to Any of the following conditions, as shown in the following screenshot:

There's more…
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset