How to write a Groovy Script to check if a user belongs to a group and hide a field ?

Hi All,
I want to write a Groovy Script to check if the current user belongs to a given group or project role. And based on that I want to hide certain fields on the screen. Is this possible with a groovy script ?
If possible, what is the syntax to check the current users group and hide a given custom field in groovy ?
Also please let me know what classes to import.

Thanks for Reading
Andrian

2 answers

What plugin are you using to write your groovy scripts? If you're using the Adaptivist Scriptrunner plugin, you have behaviors available. See this page for hidden fields behaviours documentation.

Hi @Doug Swartz

Do you know how to get rid of the below message in Behaviour Plugin. I want hide fields in the view screen. But according to the below message I can only do it in the edit screen. 

The field Description is not hideable, so it will only be hidden when the issue is editable

Any thoughts ?

@Doug Swartz

Thanks a bunch man. I do have this plugin.

Andrian

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

650 views 4 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot