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

Accepted Answer
2 votes

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
Community showcase
Posted Tuesday in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

34 views 0 2
Join discussion

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