I am trying to use ScriptRunner to restrict a couple of Priority choices for a particular project, however the documentation is deprecated, and I'm on mac which means I don't get code-completion, so I need some help (a link to up to date docs or just the code I'm missing?)
This is the code I use (from the example given)
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY
def constantsManager = ComponentAccessor.getConstantsManager()
def userUtil = ComponentAccessor.getUserUtil()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
if (!userUtil.getGroupNamesForUser(currentUser.name).contains("boardgames")) {
def allowedPriorities = constantsManager.getPriorities().findAll {
it.id.toInteger() > 2
}.collectEntries {
[(it.id): it.name]
}
getFieldById(PRIORITY).setFieldOptions(allowedPriorities)
}
Result: Nothing. All the priorities are showing.