Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Hide fields GLOBALLY based on Group

i have a interesting case where i try to hide a Field based on Group membership.
It is very important that the field is only shown to People of a certain group over a number of different Projects but it must be hidden to everyone else no matter project member ship or not. Only the Global group membership counts.

So far i tried Scriptrunner Behaviors and they work fine to hide the field if the current user is not in the defined Group BUT if i search for the Issue and use the Field in my columns i easily get access to the field and view its values.

So i tried the Script runner custom Fields and there i can set the value based on group member ship. So the value is only shown if i'm a member of the configured group.

So now i need to fuse both fields functions. The field should be filled by conventional methods but only show the value if the Group membership is correct and checked via the Script in the scripted field.
Is it possible to set the value in the Custom Scriptrunner field and keep it there and just toggle if its view able or not?

Here is my WIP:

import com.atlassian.jira.component.ComponentAccessor

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def isinGroup = ComponentAccessor.getUserUtil().getGroupNamesForUser("Can_View_Field")

return "ValueSetBefore/SavedValue"
return "REDACTED"

Or do i need to fill the field each time the Field is shown/called?

1 answer

0 votes
Florian PEREZ Community Leader Nov 16, 2021

Hello  !  

I might have wrong but I think for doing this you should use Scriptrunner behaviour instead of scripted field.  

You should be able to select you fields you need to hide and provide the condition in order to make them visible if user is in the right group. 

The following link is not exactly the same case but I think you can build up arround to get this working : behaviour case 

One other solution (but it is waaaaaay worse) can be to add an AJS into the description of each field to hide them conditionally but I do not recommand this.  

Have fun ! 


thanks for the hint!
The problem with Behaviors here is they only count in specific screens or view.
As soon as somebody searches for the Issues they can get the stored values anyway.
The Globally is an Important part here.
As we generate the Value from a outside source in this case, i could just put the logic of filling the field inside the:
return "Logic to fill the field from external source each time the field gets viewed"
But i think this will be highly unpractical and inperfomant.

Best Regards!

Suggest an answer

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

JSM Jira Automation: How to Send SLA Breached Notifications

Hi Everyone, In   this tutorial,  we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached.   SLA Threshold Trigger The SLA t...

770 views 5 13
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