How do I write a groovy expression for my workflow post-function? (Only run transition when issue priority != "HotFix")

I apologize if this question makes little sense, but I was volunteered to be the JIRA "guy" and I have zero background in programming. 

I have JIRA Misc Workflow extensions installed and I'm trying to use the "Set Field Value to constant or Groovy expression Function" to automatically set the "Priority" of an issue to "InSprint" if it's "Priority" isn't already set to "HotFix" OR "High", when they transition from "ToDo" to "InProgress". 

However, I don't know what to type into the Conditional execution box. It says, "Type a groovy expression that returns true if the post-function should run"

Since I have no idea what I'm doing with Groovy expressions, I'm pretty sure it's my attempt that's gumming up the works. Any help with that would be great. I'm not even sure this is the best way to achieve the results I want so if anybody has a better way, I'd love to know about it. 

This was my last configuration: 

Field: Priority

Value type: Raw Value

Value: InSprint

Conditional execution: selected

  • Execute if the following Groovy expression returns true: 
issue.get("Priority") != "HotFix" || issue.get("Priority") != "High"



1 answer

Your statement will always return true.  You'd want something like:

issue.get("Priority") != "HotFix" && issue.get("Priority") != "High"

Which means the priority is neither HotFix nor High, which is what I believe you want.

Thank you for taking the time to respond Mikey. I input your expression using my last configuration and it didn't appear to work as I expected. Maybe a user story with acceptance criteria would better explain my needs. As a JIRA Agile user I want to transition any issue from "Open" status to the "InPogress" status and have JIRA automatically change the issue priority to "inSprint", unless the "Priority" is already set to "Hotfix" or "High", so I don't have to edit the issue manually. AC: # on transition issue priority is changed to "InSprint" if priority IS NOT already set to "HotFix" or "High" # on transition issue priority is NOT changed if priority is already set to "HotFix' or "High"

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

498 views 2 5
View question

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