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()
}