Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,671
Community Members
 
Community Events
165
Community Groups

Summary field editable only for some project role

Hi, 

would it be possible to make the Summary field editable ONLY for certain project roles for an issue type in a project?
Could this be possible with a behaviour?

 

Thanks!

2 answers

Hey @Amelia Zaccara ,

Adding on to what @Mohamed Benziane has suggested.

As Behaviors will run in both the Create and Edit screen, this may cause some issues for you as the Summary field is a required field while creating an issue.

You can also add another condition to check if you're in the create screen.

An example below:-

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager

def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)

def summary = getFieldById('summary')
def adminRole = projectRoleManager.getProjectRole('Administrators')
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def currentProject = getIssueContext().getProjectObject()

//Set Summary field as ReadOnly only if not in the Create screen
if(getAction() != 'Create') {

summary.setReadOnly(true)

//Check for user role here
if(projectRoleManager.isUserInProjectRole(currentUser, adminRole, currentProject)) {
summary.setReadOnly(false)
}

}

Regards.

Hi @Adrien Low _ServiceRocket_ and @Mohamed Benziane
thanks for the advice.
I will add the condition in the behaviours.
Will it be necessary to create an additional line: 

def adminRole = projectRoleManager.getProjectRole('Administrators')

for each project role that is allowed to edit the summary in the issue?

 

Thank you!

Amelia

0 votes

Hi @Amelia Zaccara 

Welcome to the community.

Yes this is possible with behaviour. You just need to make the summary fiel read only and add a new condition "except user in project role"

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

315 views 2 6
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