Using Behaviours, you can restrict a comment’s visibility by setting the field options for the commentLevel field. This is a particularly useful feature for those who want to ensure that comments added during edit/transition issue can only be seen by certain users.

Restrict by Role and/or Group

Imagine that you have a workflow step where you want to require the user to enter a comment in order to move forward with the transition. In addition to requiring a comment, you only want users in the Administrators role or jira-administrators group to be able to see this comment.

By using setFieldOptions on the commentLevel field, this can be easily accomplished.

Due to the limitations of behaviours, you can only restrict comment visibility on the Update/Edit Issue, Assign Issue, and Workflow Transition screens. You will not be able to restrict comment visibility if a user adds a comment through the view screen.

Note the use of setFieldOptions. It has two forms:


pass a List (or any Iterable) of Role or Group objects

import com.atlassian.jira.component.ComponentAccessor

def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def groupManager = ComponentAccessor.getGroupManager()

def group = groupManager.getGroup("jira-administrators")
def role = projectRoleManager.getProjectRole("Administrators")

def formField = getFieldById("commentLevel")

formField.setFieldOptions([group, role])

a Map object, where the keys are in the format "group:groupname" or "role:roleID", and the values are the names of the respective Group(s) or Role(s) that will be displayed in the UI

def formField = getFieldById("commentLevel")

formField.setFieldOptions(["group:jira-administrators": "jira-administrators", "role:10002": "Administrators"])

Results in:


For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.