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 Sign up to answer
Community showcase
Published Monday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

382 views 0 8
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