Details
-
Bug
-
Status: Done
-
Low
-
Resolution: Done
-
7.2.0
-
None
-
SR4J Sprint 135 (7.5.0), SR4J 136 (7.6.0) HAPIBounty, SR4J 137 (7.7.0), SR4J 138 (7.8.0)
-
7.8
Description
After upgrading to Jira 9.2.0 cannot use setFormOptions against the priority field using either the ID and names (string value). This previously worked in 8.22.0.
Note: setFormValue on priority still works.
Steps to Reproduce
Create a new behaviour against any project and issue type.
Create initialiser script as below:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY def prioritySchemeManager = ComponentAccessor.getComponent(PrioritySchemeManager) def userUtil = ComponentAccessor.getUserUtil() def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def allowedPriorities = prioritySchemeManager.getOptions(issueContext).findAll { it.toInteger() > 2 } getFieldById(PRIORITY).setFieldOptions(prioritySchemeManager.getPrioritiesFromIds(allowedPriorities))
Go to project and edit or create new issue.
Check options available in priority list.
Expected Behaviour
Options available in priority field should be restricted to Low and Lowest.
Actual Behaviour
All options are still shown/available.
Workaround
If you have found a workaround, explain how to do it.
- One
- Two
Additional Info
Jira 9.2.0 release notes mentions a change to the priority picker for performance. Have checked component and fix version fields - these still worked as before (getValue() and setFormValue()).
Also used the alternative script below which worked in 8.22.0 but not in 9.2.0:
import com.atlassian.jira.component.ComponentAccessor def priority = getFieldById("priority") def constantsManager = ComponentAccessor.getConstantsManager() def prioritiesToShow = ["Low", "Lowest"] def allowedPriorities = constantsManager.getPriorities().findAll { prioritiesToShow.contains(it.name) }.collectEntries { [(it.id): it.name] } def priorityToSet = allowedPriorities as Map priority.setFieldOptions(priorityToSet)
Attachments
Issue Links
- is duplicated by
-
SRJIRA-6322 No longer able to restrict priority options with Behaviour on Jira version 9
-
- Done
-