As many of you know Jira version 7.6 has schemes for the Priority field.
But what about the Jira Server that are not updated? We can do something? …. Yes, if we have Scriptrunner. We can use Behaviours! (here the documentation)
Use this code:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.sal.api.user.UserManager import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY def constantsManager = ComponentAccessor.getConstantsManager() def userUtil = ComponentAccessor.getUserUtil() log.debug ComponentAccessor.getComponent(UserManager) //def currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser() //if (! userUtil.getGroupNamesForUser(currentUser.name).contains("jira-developers")) { def allowedPriorities = constantsManager.getPriorityObjects().findAll { it.id.toInteger() < 6 }.collectEntries { [(it.id): it.name] } getFieldById(PRIORITY).setFieldOptions(allowedPriorities) //To set default value to Priority uncomment below lines and change the ID //getFieldById(PRIORITY).setFormValue("4") //}
We can use it as initialiser and a Field server-side script (with the Priority field of course)
After that:
- Create a screen with the name “Set Priority” and with the system field “Priority” placed on it
- Add a recursive transition in the Workflow and name it “Set Priority” and add the screen “Set Priority“
- Remove the field “Priority” from the “edit” screen. In this way, you can change only the Priority using the button “Set Priority”.
Remember, if you want to set a DEFAULT PRIORITY when you create a new ticket, uncomment the line getFieldById(PRIORITY).setFormValue(“4”) and change the “4” by your PRIORITY_ID
That’s all!
By MrAddon