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("jira-developers")) {

def allowedPriorities = constantsManager.getPriorityObjects().findAll { < 6
}.collectEntries {

//To set default value to Priority uncomment below lines and change the ID

We can use it as initialiser and a Field server-side script (with the Priority field of course)

Captura de pantalla 2019-06-06 a las 18.57.18

After that:

  • Create a screen with the name “Set Priority” and with the system field “Priority” placed on it

Captura de pantalla 2019-06-06 a las 19.07.14

  • Add a recursive transition in the Workflow and name it “Set Priority” and add the screen “Set Priority

Captura de pantalla 2019-06-06 a las 19.07.00

Captura de pantalla 2019-06-06 a las 19.06.53

  • 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

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s