Skip or follow a transition step based on cutom field value

I have a situation here

Normal Flow --------------------- Dev-Requestor-Close

Another flow is ------------------ Dev-Requestor-QA-Close.

Want some way to implement this based on if a checkbox is checked for QA and accordingly follow the route.

Any help appreciated.

4 answers

1 accepted

This widget could not be displayed.

I was able to get around this.

Using Script Runner plugin from JIRA Marketplace.

First, created a field called QA testing Required with 2 values 'Yes' and 'No'.

I create 2 transitions by the same name so as not to confuse the user.

1. Script workflow function : Simple scripted condition : Checks script:

cfValues['QA Testing Required']*.value.contains('Yes')

This is now flowing to the QA person.

2. Script workflow function : Simple scripted condition : Checks script:
cfValues['QA Testing Required']*.value.contains('No')

This skips the QA and follows to the last step.


I am having the same situation. Can you please explain your solution in detail.

@Ram,

What I essential did in my solution was to create a dropdown field with 2 values 'yes' and 'no'

I made 2 transitions named 'Ready to Test'. One of them ended up with the QA person if the feild was set to YES and if no the issue flowed directly to the end user for testing.

To accomplish the above i.e. which route to take I installed 'Script Runner plugin'.

Then in the workflow. Go to each transition and perform below steps

  1. Click on transition and select 'View Validators'
  2. Click on 'Add' link on the screen
  3. Scroll down and select 'Script Validator'
  4. Click on 'Simple scripted validator' [Built -in Scripts]
  5. Scroll down below condtion textbox
  6. Click on 'Has custom field value equal to'
  7. it will display "cfValues['SomeCustomField'] == 'Some Value'"
  8. Replce the code with my condtions as above.i.e. 'cfValues['QA Testing Required']*.value.contains('Yes')'

I used value.contains as its a drop-down value.

Should be pretty simple once this goes fine.

This issue can be resolved in much easier way by using 'condition' 'value field'.

I agree.

At the time when this solution was implemented I didn't have that option of Condition+ Value Field. I use the value field now and depending on the field value appropriate  transition is displayed. In order to have the user unaware I name both transitions as exactly same so the user clicks on the same button for either flow.

hi @Rizwan Rizvi, can you explain why you have two transitions with the same name?

Albert,

I wanted my user to be unaware of the difference in transition. So when my approver clicks on that 'Ready to Test', he is not aware which flow would be taken up. That decision is through the condition field. If YES, the next step is 'In QA' and If NO, it skips QA and goes directly to the UAT part. makes sense?

i am done with my script but the next question is, how would it know what transition to go to?

i need my transition to check if the location is CN, it should go to CN Validation, else, it goes straight to Approve transition. i dont know where to put the if, else.

This widget could not be displayed.
I am kinda confused here. As you are talkin about workflows you may mix sth up ? Please clearify if this isn't maybe a transition thing. If so just add 2 transitions and configure a condition to each of them. Sth like "only show if..." Maybe you will need to install additional plugins to get this https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions

I do get what you are saying but in my case there is a field called 'Set for QA Testing'. Now this feild can have a 'YES' or 'NO' value.

If its YES, I want the flow to be

DEV > Requestor > QA > CLOSE

But if the value of this field is NO, the flow would be

DEV > Requestor > CLOSE.

Does this explain clearly?

Are you sure this isn't a post-function that would fast track to a status based on a custom field?

Curious if you've any problems using post function fast track transition or how you got this to work

Janene 

Well, it all depends on your target. In our case we have 5 possible transitions depending on a certain value in a certain custom field (which is a result of a multiplication during the previous transition). We thought about embedding a Groovy or Pyton script. But one condition for every single transition out of those 5 transitions is the most elegant solution. If the conditions is untrue the transition will be hidden. And it's far less effort compared to a script that has to be written before. Thank you Candy, you made my day!

It doesn't work with me, i created two transition with the same name then open one of them and add a validater  and am still able to move the ticket on the workflow no matter which custom field value is selected. 

This widget could not be displayed.

A bit of a hack I was able to get working, was to use the free Automation add-on; https://marketplace.atlassian.com/plugins/com.atlassian.plugin.automation.jira-automation-plugin/server/overview.

By setting up a rule which fires a cron every minute, runs JQL to find issues where my custom field = x, and takes Transition Action to the desired status. It is not instant, but it met our needs and so far works great.

This widget could not be displayed.

Well it seems that now you can't create 2 transitions with the same name any more...

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

181 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you