Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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
Contributor
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
TAGS
atlassian, ace, atlassian community event, donation, girls who code, women in tech, malala fund, plan international, kudos, community badge, badge, atlassian badge, International Women’s month, International Women’s Day, women's month, women's day

10 for Change at Atlassian Community Events

Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!

Join an Atlassian Community Event!
AUG Leaders

Upcoming Jira Events