groovy script workflow condition for project ID in Jira

David Mallon May 1, 2014

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

3 votes
Answer accepted
Boris Georgiev _Appfire_
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.
May 1, 2014

Here's the code:

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

Ritu Garg October 9, 2014

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.

Ritu Garg October 9, 2014

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

Sascha Lang April 22, 2021

The code from Boris works for me. Thanks a lot @Boris Georgiev _Appfire_ 

0 votes
webspin May 8, 2014

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

David M

Amy Bell January 7, 2015

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

0 votes
webspin May 7, 2014

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'"

Boris Georgiev _Appfire_
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.
May 7, 2014

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

Like Michael_Lazar likes this

Suggest an answer

Log in or Sign up to answer