We have a custom field (Single list-Single select) with 10 values(ex- a,b,c,d,e,f,g,h,i,j)
Now would like to use this custom field on creating two different issue-type(A, B) on same project.
But while creating issue-type (A). We need values to be displayed only(a,b,c,d,e)
and while creating issue-type (B). We need values to be displayed only(f,g,h,i,j)
knowing this is not possible using custom configure. which would end up creating two field of same type and name.
Wanted to check whether this is possible through behavior? Could someone please suggest. How to proceed in this?
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def selectList = getFieldById("customfield_18736")
def customField = customFieldManager.getCustomFieldObject(selectList.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
if (issueContext.issueType.name == "Ambulatory Change Control") {
def optionsMap = options.findAll {
it.value in ["Maintenance", "Configuration", "Migration", "Enhancement", "Domain Wide Update", "Custom Build", "New Build", "None"]
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
selectList.setFieldOptions(optionsMap)
} else{
def optionsMap = options.findAll {
it.value in ["Normal", "Emergency", "None"]
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
selectList.setFieldOptions(optionsMap)
}
Hello,
It is not possible in Cloud.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You would need an app for it like Power Scripts or ScriptRunner.
If you want to use the Power Scripts app, you can find a tutorial here:
https://confluence.cprime.io/display/TR/Restrict+a+select+list+to+not+show+certain+values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.