Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

ThinkTilt is joining the Atlassian Family!

This morning, Atlassian announced the acquisition of ThinkTilt , the maker of ProForma, a no-code/low code form builder with 700+ customers worldwide. ThinkTilt helps IT empower any team in their or...

410 views 19 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you