Workflow Transition in Jira: How to allow all statuses except one to transition to a particular states

DebarpitaP July 17, 2014

I have a workflow in which I have introduced a status'On Hold' Now I want all the statuses to be able to transition to 'On Hold' except for the 'closed issue' status.

Selecting the checkbox 'Allow all statuses to transition to this one' will mean even The 'Closed issue' Status can be put On Hold. Which does not seem logical.

I know I can add transition from each status to 'On Hold'. But is there a better way to do it?

4 answers

8 votes
Augustin Delaporte July 7, 2016

Hi,

I wanted to achieve the same thing with the `Duplicate` state and didn't want to have incoming transitions from all other statuses smile

Solution 1 (Failed)

Add the following condition: `Previous Status Condition` to the transition. Check `Most recent status only` and also `Reverse condition`.

But this doesn't work because it checks for the previous status and not the current status of the issue.

Solution 2 (Success)

Add the condition: `Value Field Condition` to the transition. Choose `!=` and type the String value of the status you want to exept. Make sure it matches with capitals letter (i.e. DuplicateWon't Fix).

This will work as a charm!

Henning Kasch September 14, 2016

This works! Note the "Value Field Condition" is part of the free add-on "Suite Utilities for JIRA"

Like Bobby Rai likes this
Nitesh Utmani June 23, 2021

Thanks, it works perfectly.

1 vote
jachiev July 7, 2020

Hello,

I think I had the same problem. I solved with Scriptrunner (I have version 6.0.x)

  1. Edit your workflow
  2. Select and edit the "All" transition you want that every other status go, except for the issues in "EXAMPLE" status
  3. add a Condition to the transition
  4. If you have scriptrunner you would be able to see "Simple Scripted Condition" Option
  5. add this groovy code:
  6. // EXAMPLE STATUS ID = 11000
    if
    ( issue.getStatus().getId() == '11000' ) { return false; }
    else { return true; }

     

  7. The status will now be removed from transitions if the current status of the issue is "EXAMPLE"

I hope it helps

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2014

No is the short answer. The reason the "all" is there is to save the effort of having to link a transition loads of times. But there's no way anyone can predict "all except". For that, you should do it the way it's designed - create one transtion and reuse it where you want.

The other option is to add a condition to the transition that says "if current status = closed, do not allow transition". It'll look odd in your workflow diagrams, but the users won't be able to use the transition.

DebarpitaP July 21, 2014

Hi Nic,

Thanks for the solution. I will try to incorporate the same. If it is successful I will update the forum with the result.

Supriya Jha September 5, 2017

I am guessing there have been changes in "transition editing" since this answer was written because I do not seem to have the ability to add a condition as I wish. Upon clicking the "Add Condition" button it lists out a set of conditions (radio buttons) to choose from. And "if current status = closed, do not allow transition" is not one of them.

Any idea how this requirement can be achieved now?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 6, 2017

It's not been removed.  It was never there in the core product - you have to add it yourself with an add-on that provides the condition, or create a script for it.

Supriya Jha October 9, 2017

Thank you for your answer Nic.

Which add-on provides the condition?

I also need to know how to add a script to a condition. 

Azfar Masut
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2018

Supriya,

You can use Current Status Condition (JMWE add-on)

Ankit Jindal January 20, 2019

Thank you for your answer.

If I need to exclude the current status in the transition, how can I do the same?

For example: If a task is currently in Progress and it can move to all transitions except the current one(in progress) and Resolved.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2019

Change the workflow so that it does not have the transitions you do not want in it.

0 votes
Pavan Kumar October 27, 2020

I have created a custom field "Closed State"(Single line text) with value Yes

On close transition, a postfunction - update custom field to set "Closed State" as Yes

Added a condition for "On Hold" transition as value field "Closed State" != Yes

Hope it helps 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2020

That really doesn't help, as you now have a custom field to partially represent status, and it's nothing to do with the workflow.

You should remove that field and put your workflow together properly, such that it represents the closed status and others correctly.

Suggest an answer

Log in or Sign up to answer