Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,505
Community Members
 
Community Events
176
Community Groups

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

3 answers

1 vote

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 ?

Hi folks,

 

I have the same question, but I am using JMWE add-on. Been playing with variables, but can't find how to check if current user is member of the role.

 

Thanks a bunch

These are the steps i have in PF, after create event:

The following will be processed after the transition occurs

  1. Creates the issue originally.
  2. The first applicable transition from this list will be triggered on the issue:
    • Open of workflow TEST WF

    Run this post-function only if the following condition is true:

    currentUser.isInProjectRole("Developers", issue.get("project"))

     

  3. Re-index an issue to keep indexes in sync with the database.
  4. Fire a Issue Created event that can be processed by the listeners.

@Doug Swartz

Thanks a bunch man. I do have this plugin.

Andrian

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events