groovy script workflow condition for project ID in Jira

Hi, I need to make a condition in Jira workflow so that a transition is allowed only if a jira ticket is in a particular project, the project key would be ES

I am trying to do this with groovy but cannot get it going.

Any help would be graetly apreciated.

3 answers

1 accepted

Here's the code:

issue.getProjectObject().getKey() == 'ES'

Its not working for me. I am trying to in POST function to Set Field Value to constant value with Conditional execution. code is : if(issue.get("projectKey")=="BO") return true; } else { return false; } Please help to solve this problem.

Also tried : if(issue.getProjectObject().getKey() == 'BO') return true; } else { return false; }

Hi, thanks, I tried that and got te error below

Errors

  • NoViableAltException(8@[478:1: operator returns [Operator operator] : ( EQUALS | NOT_EQUALS | LIKE | NOT_LIKE | LT | GT | LTEQ | GTEQ | IN | IS NOT | IS | NOT IN | WAS | WAS NOT | WAS IN | WAS NOT IN | CHANGED );])

Script workflow function : The action will be allowed if the issue matches the JQL query: "issue.getProjectObject().getKey() == 'ES'"

It seems you're using the wrong condition. You should use simple scripted condition.

Hi Boris, thank you so much, it works great. Lucky to have people like you around

David M

Can someone post what the final script would look like then?  Sorry, I didn't follow the "simple scripted condition" fix.  Thanks.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

133 views 5 9
Read article

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