Checkbox syntax and conditional transition

Neal Hewer July 25, 2011

I want to create a conditional transition based on the contents of a simple single yes / no checkbox. I've created the checkbox. I've created the transition between state 1 and 2, and 1 and 3. I can see how to apply a condition to the transition, but it is not clear how I define the check. Am expecting some sort of field check, but its not clear at all.

Does anyone have any ideas.

2 answers

1 accepted

1 vote
Answer accepted
Neal Hewer July 26, 2011
After some playing arounf trying to set the condition on a string I finally found a solution using the below.
State 1 to 2 if checkbox = checked. Add transition condition, checkbox field != null (leave value blank) string compare
State 1 to 3 if checkbox = unchecked. Add transition condition, checkbox field != null (leave value blank) string compare
0 votes
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 25, 2011

Actually, you can't do this the way you're thinking.

You've already noted that a condition will prevent/allow a transition to show on the basis of *existing* data - that is, what is on the issue before the user goes into the view screen. That solves your problem for existing data - define two transitions with opposing conditions (one has "allow if checkbox = yes", and the other "allow if checkbox = no"), but it doesn't help you with the case where you put the check box on a transition screen and the user changes it. This is because the condition checks are done before any transition, and the change of data happens during the transition.

The other two options on a transition won't help you either.

Validators accept the input from the users, so they look like a possibility, until you realise that all they can do is return a true or false. True allows Jira to continue the transition, false throws the user back to the screen they were in with an "invalid data" message. So that's no good.

Post functions execute after the transition is completely validated, and can do all sorts of data processing. But ultimately, there's a structural problem - the post-function is running inside the transition, and your code would need to stop that dead and start running the other transition, which is an absolute bloody nightmare to code around. I don't know of anyone who's managed to do this successfully, and the people I know who have tried have said they would need to hack the os_workflow library apart to do it.

There is a reasonably simple work-around though.

Given your states 1, 2 and 3, set up

  1. A transition from 1 to 2
  2. A transition from 2 to 3
  3. Write a listener that will listen for 1-2 and push the issue through the 2-3 if the data means it should have done 1-3

Far from ideal, but that's the only way I know of doing it.

Neal Hewer July 25, 2011

The above was just a snippet of the workflow. The decision on whether to progress to state 2 or 3 is made some states before state 1 (Its actually at creation this field is set). In other words the checkbox is in the correct state on entering state 1. In any event it would be useful to know the syntax used for checking checkboxes...

Your help is much appreciated - from a JIRA newbie.

JamieA
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.
July 27, 2011

By "conditional transition" I read a condition for a transition. It sounds like Nic is reading an automatic transition if a condition is true. If that's what you're after, and by your own answer I don't think it is, take a look at auto-transition. Plugin details on parent page.

Suggest an answer

Log in or Sign up to answer