I am looking for help trying to figure out how to implement a workflow transition scenario, using the following example to illustrate my point.
The workflow is: To Do > In Progress > Done
I would like to enable a transition directly from To Do > Done only if the Resolution field value selected is "Won't Fix" or "Duplicate". Thus, selecting another value, such as "Fixed", will prevent this transition.
I have the following add-ons available to use: JMWE, JSU, and ScriptRunner.
Hope someone can shed light on a solution, as I've come close to figuring it out but am not there yet!
you can add a Scripted (Groovy) Validator to the transition from To Do to Done, which will show an error if the user selected a Resolution other than "Won't Fix" or "Duplicate". The Groovy script will be:
issue.get("resolution")?.name in ["Won't Fix", "Duplicate"]
Thanks for the answer, which did the job after I did one more adjustment.
I had to first add a Screen as part of the transition from To Do to Done, whereby I needed to select a Resolution field value.
Once I added this Screen to the transition, in addition to your recommended Validator, it prevented/allowed the transition as desired.
You have a catch-22 in that you usually set the resolution in the transition, not before. So any conditions based on resolution would not work. (no one makes a "read my mind" condition :) )
So you can have 2 transitions, and use a validator on the "done" one to prevent the transition from succeeding in the resolution isn't the ones you are limiting.
So if the user selects the one to go directly to done, but tries to pick a resolution other then "won't fix" or "duplicate" it will not succeed and they wont be able to execute the transition.
I think that neither of above answers are right, to elaborate why:
- workflow condition will evaluate whether a transition is available in the first place, i.e. the resolution would have to be set in the 'To Do' status, which is just not how issue tracking works in general, and Jira won't allow this way of working because if you add resolution to a screen, it's always required, so it would end up with very random values just to get away with the "field required" thing, just how it is - don't do it if it's not a transition screen
- workflow validator will evaluate whether a transition is allowed, often used in conjunction with a transition screen, most typically this would entail a required field to be filled out, a comment to be added, so forth
So you really end up with 2 options here, either you have a resolution added in the 'To Do' status, to have that transition to Done available -- which does not make a lot of sense to add a resolution to an open status (and Jira does not expect a resolution on an open status).
Or, you apply a validator. But if you are trying to transition to some status and the validator pops up and says "hey, I don't like that resolution, you should change it", then that makes that resolution pointless.
Middle ground scenario - have a "simplified workflow", where any status can go to any other status. Or add a transition from To Do > Done, with appropriate name to perhaps identify when to use it. In any case I would say a simplified workflow would work the best, with a transition screen for the 'Done' status where the user can select the resolution.
Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events