Check project category in validator - groovy script

Hello

I need to check issue's project category in workflow validator

I think that the best way is check it using groovy script.

Trying to execute

issue.projectObject.category == 'CategoryName'

it returns error: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: category for class: com.atlassian.jira.project.ProjectImpl

 

Is there any command to get and check project category in validator?

 

Thanks,

Fyodor

 

1 answer

1 accepted

Accepted Answer
2 votes

See javadoc and use issue.projectObject.projectCategoryObject.name == 'CategoryName' instead.

Probably want to be null-safe there... not all projects have a category: issue.projectObject.projectCategoryObject?.name == '...'

Hello Thank you for assistance. issue.projectObject.projectCategoryObject?.name == '...' works. Fyodor

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

1,890 views 4 6
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