You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.