Hey All,
So, I wrote this code a bit back and it was working perfectly till something happened recently. I'm not able to pinpoint exactly when it happened or anything around where it started, but I have a Cascading Select List called Category. I have a few forms on service desk that use specific options from category and hide the rest (so not as to over encumber the user.)
Recently something happened that all of them are now showing all options. I've opened a ticket with Adaptavist about it, but figured I'd see if anyone had any issues like this.
Additionally, I have nearly identical code running internally that is hiding field options on the Jira Software Create ticket button for the same project. This code is working flawlessly, but when transferring it over to Service desk, same thing, fields show.
This isn't limited to one project either, it's any project working with cascade fields. and in both my stage and my prod environments
Software is version 9.12.8, Service management is 5.12.8
Has anyone had something like this happen? Anything I should look for in particular?
Thanks in advance!
Here is the code for reference in the initializer:
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
//import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfigImpl
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def allowedOptions = null
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def Category = getFieldByName("Category")
def CategoryCustomField = customFieldManager.getCustomFieldObjectByName("Category")
def c_fieldConfig = CategoryCustomField.getRelevantConfig(issueContext)
def c_customField = customFieldManager.getCustomFieldObjectByName("Category")
def c_config = c_customField.getRelevantConfig(getIssueContext())
def c_options = optionsManager.getOptions(c_config)
//Category
// Set the values inside the select list field for Request Category
def CategoryMap = [null: "None"]
CategoryMap += c_options.findAll { it.value in ["New Access Request","Microsoft Office Suite","Virtual Desktop"]}
.collectEntries { [(it.optionId.toString()): it.value]}
Category.setFieldOptions(CategoryMap)
//getFieldByName('Type').setHidden(true)