Is it possible to block a workflow transition based on values in custom fields?

Kara Hopkins September 25, 2020

Here is the use case:

I have 4 custom fields:

Compliance sign-off required (Yes/No)

Business sign-off required (Yes/No)

Compliance sign-off by (Name)

Business sign-off by (Name)

If, when transitioning a ticket to 'Resolved', 'Yes' has been indicated against either 'Compliance sign-off required' or 'Business sign-off required' and an associated name has not been populated, I want the transition to be blocked.  This is to stop changes being deployed to production which have not been fully signed off in our pre-prod environment.

Is this possible?

1 answer

1 accepted

0 votes
Answer accepted
John Funk
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 25, 2020

Hi Kara,

Yes, you can put conditions on the transitions of the workflows to block them if the values are not set. 

Kara Hopkins September 28, 2020

Great, how do I do it? I had a look at the workflow settings but I couldn't work out how to block the transition only in the following scenario (in that it only matters if the field is null when the other field is 'Yes'):

Given custom field A = Yes

When custom field B is null

Then block transition 'Resolved'

John Funk
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 28, 2020

Do you have a separate transition called Resolved? Or is that just a value in the Resolution field for the transition to Done? 

If the transition is indeed called Resolved, then add two conditions to the transition. 

Select Value field for the condition and click Add.

Choose Custom Field A from the dropdown list

Choose = for the condition

And put Yes in the value field.

You can do the same for addition a second condition, except leave the value field blank for null. 

With these two conditions, the transition for Resolved will not be visible unless both conditions are met. 

Kara Hopkins September 28, 2020

Thanks.  So I have added these rules, but I am a bit confused.

How does the system know that the second condition is dependent on the first? I am failing to identify how it is linked?

Also, I don't want to block the issue being 'Resolved' if the value entered is 'No' rather than 'Yes'.  If 'No' is entered then then custom field B will always be null...

 

Screenshot 2020-09-28 at 14.15.59.png

Trudy Claspill
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 28, 2020

At the top of the Conditions tab is a pull down field that lets you designate how the Conditions will be evaluated. The choices are:

All of the following Conditions

Any of the following Conditions

Screen Shot 2020-09-28 at 7.36.58 AM.png

If "All" is selected, then all the conditions must be true for the transition to be blocked.

If "Any" is selected, then if any one of the conditions is true, the transition will be blocked.

You can also use the Grouping feature to group conditions and change the All/Any applied to each group to make more complex scenarios.

Screen Shot 2020-09-28 at 7.40.07 AM.png

John Funk
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 28, 2020

Sorry - was in Staff Meeting. Conditions are done in combination with each other. Trudy has done a fantastic job of describing how that works - either through singular conditions that use an All or Any function. Or by grouping conditions together to create multiple possibilities. 

Let us know if that works for you!

Kara Hopkins September 28, 2020

Excellent, thanks both.  I've followed all the instructions so confident that should now work.

😊

Kara Hopkins October 1, 2020

Hi, please can I have some more assistance as this hasn't worked how I needed.  I have tried both the 'All' and 'Any' mentioned above.

If I choose 'All' then the tickets which are marked as 'No' to the compliance and business sign off are being blocked from transitioning to 'Resolved'.

If I choose 'Any' then where the 'Compliance sign-off required' and 'Business sign-off required' is marked as 'Yes' but the name is only populated against 1 of the fields, then the ticket is still transitioning to 'Resolved' when it should be blocked from doing so.

Here's how I have it set up:

Screenshot 2020-10-01 at 15.08.11.png

John Funk
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 1, 2020

Hey Kara,

I think you have it right except for the Only users with Resolve Issues permission can execute this transition. Since it is a part of the Any, the anyone with that permission can execute regardless of the other conditions. 

So to solve that I would either move the Resolve Issues to a validator instead of a Condition or add it to both of the other sections next to the Required? = Yes fields. 

Finally, if a user can move the card if neither of the Required? fields = Yes, then you need a way to handle that. Because right now, cards with No for both of those fields will not be able to move. If you DO need that, then it would got down where the Resolve Issues permission line is (at the very bottom). 

Try those changes and see how it goes. 

Kara Hopkins November 6, 2020

Thanks, sorry for the late reply. I still cannot work this out.

If I set the very top condition (on the screenshot)  to be 'Any' then I can set e.g. Business sign-off required as 'Yes', enter the associated name and date and I am able to resolve the ticket (as expected, if I don't enter the name and date then I am unable to resolve).

However if I also set e.g. Compliance sign-off required as 'Yes' but do not enter the required name and date, I can still resolve the ticket.

If I set the top condition to be 'All' then it doesn't work either.

I am obviously doing something wrong, but I just can't seem to work out what it is!

Screenshot 2020-11-06 at 09.44.48.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2020

Hey Kara - without jumping into this too much, what if you did the following:

In the first condition text above, change "not equal" to "equal" and change "NULL" to "Yes"

Get rid of the 3rd condition and move the 4th condition up to the same level with conditions 1 and 2

In the 5th condition - do the same as you did in the first condition above.

Same thing for the 7th and 8th conditions based on the 3rd and 4th conditions above. 

Finally, I would change the last two conditions to be equal to No

And I would require a value for the field so that Null is not an option. 

Give that a try and see what you get. You are very close though, I think. 

Gal Haase November 25, 2021

@Kara Hopkins @John Funk 

Hi!
I just read this thread as I am looking to do a very similar thing to what Kara did. I had come across a different issue that I do not understand.

When I go to "Conditions" -> "Value field" I do not see any of the custom fields we have in the workflow, just the default fields.

What am I missing?

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2021

@Gal Haase 

Welcome to the community.

In the future, if you need additional help related to an issue mentioned in a post that is already marked as Answer Accepted, I recommend that you create a new post to describe your issue and include a link to any other post that is relevant that relates to your issue. Adding on to an older, solved post does not get your "new" question displayed in the first page of the Questions page.

Regarding your question, the value field condition only works for system fields, so you would need an app like JSU Automation Suite for Jira Workflows or Scriptrunner in order to use it with custom fields. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events