Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,555,289
Community Members
 
Community Events
184
Community Groups

JIRA Adaptivist Behaviors to turn off edit pencil

We are testing a Behavior to only allow Project Admins to update Priority.

We did the documented steps to make Priority readonly except for people in the Role Administrators. This works but leaves the edit Pencil on the field. When a non-Admin user clicks on the pencil they get the Edit screen with the Priority grayed out.  I have tried the following in the Initialiser but does not seem to have an effect:

getFieldById("Priority").setReadOnly(true)

Any suggestions or additional steps would be much appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 17, 2018

Hello @Rich Wolverton

Scriptrunner behaviours doesn't work on view screen. Clicking the pencil will always open edit screen, so your main goal is achieved. 

But if you stiil want to remove the edit pencil, the only possible way is to write some JavaScript code and place it in the announcement banner for example, but this method strongly not recommended.

Thanks @Mark Markov but disappointed.

When allowed to update Priority there is a drop down that shows Priority values. It is only for the large community that is not allowed to update that they get the 'edit' screen.  Just seems more intuitive that readonly would suppress the edit Pencil. 

Adding the two screen shots, one for an Admin user and normal userAdmin User.jpgNon-Admin.jpg

@Rich Wolverton 

This is my initializer code. There might be redundancies in the imports and defs but this should work.

Edit pencil is not turned off but Priority is only editable to Administrators in Edit Screen.

 

import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.project.version.VersionManager


def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def prio = getFieldById("priority")
def isAdmin = "Administrators" in remoteUsersRoles

Long projectId = issueContext.projectObject.id


prio.setHidden(true);

if ( isAdmin ){
  prio.setHidden(false);
} else {
  prio.setHidden(true);
}

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events