Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Making a field visible just for specific group of people or project roles

Negar Mousavi July 19, 2023

Hey there

for my IT Help service desk project in Jira the people who are responsible for the issue wants to have a comment that is only visible through their team or even some specific roles.

i thought to make a field for their case of use that they can fill it through editing issue.

I want this field to be visible for them in editing screen and viewing screen of the issue.
I can restrict editing for everyone and give access to that group but for viewing I want every one to view the issue but that specific field can be visible only for that group.

I have created the custom field and the group and i used Scriptrunner Behaviours to do this but it doesnt work and everyone else can still view the field.
I have mapped the project and issue type correct and i wrote the script for that field.

this is my code :

import com.atlassian.jira.component.ComponentAccessor

def customFieldId = "customfield_10697"
def groupManager = ComponentAccessor.getGroupManager()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def isAdmin = groupManager.isUserInGroup(currentUser, "jira-administrators")

if (!isAdmin) {
    def field = getFieldById(customFieldId)
    field.setHidden(true)
    field.setRequired(false)
    field.setFormValue(null)
    field.clearError()
}

1 answer

1 accepted

0 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 19, 2023

Hi @Negar Mousavi

In your description, you mentioned:-

for my IT Help service desk project in Jira the people who are responsible for the issue wants to have a comment that is only visible through their team or even some specific roles.

Do you want the field to be hidden in the view screen or only on the create and edit screen? If it is the former, this is not doable via behaviour.

Looking forward to your clarification.

Thank you and Kind regards,
Ram

Negar Mousavi July 19, 2023

Hi
thanks for your answer, I wanted to be hidden in the view screen for specific roles or users. is there any other way to do this ?

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 19, 2023

Hi @Negar Mousavi

If you intend to hide the field on the view screen, you will need to use other third-party plugins to achieve this like Secure Fields for Jira or Field Security Plugin for Jira.

Please refer to this community post for more information.

I hope this helps to solve your question. :-)

Thank you and Kind regards,
Ram

Like Avinash Kumar likes this

Suggest an answer

Log in or Sign up to answer