How to use user properties in jira workflow validator? Edited

Hello,

 

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

Hello Rajeswari.

You can check out this answer from the community. 

In it you will see the proper way of accessing user properties.

Do not hessitate if you have anymore questions.

Cheers!

Dyelamos

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 11, 2018 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. ...

2,472 views 5 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