I've only used groovy scrips in workflows, but I have a requirement to restrict users from editing the priority AFTER creation to only certain priority values. Obviously they can do this any time after the Open transition
Community moderators have prevented the ability to post new answers.
Hi Brian,
You can try downloading version 0.5.10 of Behaviours from the marketplace.
Thanks
Kristian
Hi Brian,
This can be done using the Behaviours plugin by applying the following code below as a behaviour to to the Priority field. You will also need to add a condition which states Except - Workflow Action = Create.
This will then mean that all the priorities will be available when an issue is created but only certain priorities specified will be available during all other statuses in the workflow.
import com.atlassian.jira.component.ComponentAccessor import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY // Check if the Issue is in the Create transition and if false restrict the priorities available if (getActionName() != "Create") { def constantsManager = ComponentAccessor.getConstantsManager() // Only show priorities which have an ID greater than 2 def allowedPriorities = constantsManager.getPriorityObjects().findAll { it.id.toInteger() > 2 }.collectEntries { [(it.id): it.name] } getFieldById(PRIORITY).setFieldOptions(allowedPriorities) }
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, we are in JIRA 6.1.6 and 2.1.16 is the highest version we can use. is there an older version of behavior plug-ins we can install?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
Behaviours was merged with Script Runner in version 3.0. In order to be able to implement the code above using behaviours then you will need to upgrade to a version of Script Runner greater than 3.0.
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
You are correct in stating that Behaviours comes with Script Runner. If you install Script Runner into your JIRA instance you will notice that you get the Behaviours link appear on the left hand side of the screen under Administration > Add Ons.
Once you navigate to this link you will then be able to set up a new behaviour set with a mapping to your project(s) and Issue Type(s).
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response Kristian. The Behaviors plugin has been merged with Scriptrunner. I'm not seeing how to apply the behavior to a system field. Outside of workflows, I have not used scriptrunner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.