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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

243 views 0 6
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