validating user properties in create issue transition


I wanted to validate user's group while creating issue. We have a field GROUP which is in user property. I wanted to allow create issue permission to one particular group of users. 

I have a user property named GROUP with values G1,G2,G3,G4. Only G1 users can create issues. I wanted to restrict create issue access to other GROUP users.

I tried to add validator in Create transition using following script but no luck :

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.user.UserPropertyManager

UserPropertyManager userPropertyManager = ComponentAccessor.getUserPropertyManager()

if (issue.reporter) {
userPropertyManager.getPropertySet("GROUP") != 'G1'

How can I achieve this?

Thanks in advance.

1 answer

0 votes

Why are you doing this?  You can achieve the same far more cleanly and better with simple group memberships.


Could you please precise?

FYI we don't have any 'User GROUP'. These user categories are driven from external ED using scripts. This user details (G1,G2,G3,G4) are present only under 'User Properties' and yes also in Custom fields (using nfeed) but those values filled post creation of issue. 


But I need to validate while creating issue. If reporter is not in G1 then they cannot raise issues.

User Property Key : GROUP

Values : G1,G2,G3 and G4


I don't understand why you are doing it this way.  It's clumsy, frail and not transparent.  You're doing a lot of work to do something JIRA does off-the-shelf in a really simple way.

Put your users into groups.  Use the permissions to say "only users in group 1 can create issues".

I have nearly 20k users. All users belongs to these categories. So it is difficult to find them and group. Users will get added on a daily basis. it is difficult to find them everyday and add them in group.


So i found using 'User Property' value is simplest.

It's absolutely not the simplest way to do it.

You still have to identify your users and then set a property to do it.  Why not simply set a group instead? 

Also, this makes me suspect that you're setting the user properties in a way that is wrong, as there's no easy way to do it reliably, and if you were doing it the reliable way, you would not need help with this question!

I know I'm not being "helpful" here, but your approach to this is pretty much broken, and it is always worth questioning it when we see that.

If you insist on persuing it badly though, then the problem is in your line

getPropertySet("GROUP") != 'G1'

This "get" does not return a simple string, it returns a whole property set for the user's properties.  Even if you have only set one, it's still the whole set that comes back.  This is documented at and you'll see you need to find your property within that and pull it out to be compared.

But that's what you should have used when you are setting the properties (which is why I'm worried about how you are setting them)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,380 views 15 19
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