Hi Community, is it possible to hide certain values/options in Priority Field (System Field) on Customer Portal based on Issue Type (Incident)
I am using this code in Behavior using Scriptrunner, and I know I might doing it wrong, can you help me out of it? Thanks!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*
// Get the current issue type from the issue context incase the issue
// has not been created yet
def issuetype = underlyingIssue?.getIssueType().name
// Get a pointer to my select field
def selectcf = getFieldByName("Priority")
// Get pointers to the required custom field and otion managers
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = customFieldManager.getCustomFieldObject(selectcf.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
// If issue type matches change the cf values to be displayed
if (issuetype.contains("Incident")) {
def optionsMap = options.findAll {
it.value in ["A", "B"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
selectcf.setFieldOptions(optionsMap)
}