Hello team,
I am using scriptrunner behaviour in order to restrict field values based on another field values selection
I have an error, can you please check how to resolve it
Error :
com.onresolve.jira.groovy.user.FormField#setFieldOptions(java.util.Map <?, java.lang.String>) with arguments [java.util.Map <java.lang.Object, java.lang.Object>]
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
int instanceId = 15950
def instance = getFieldById("customfield_15950")
def instanceValue = instance.getValue()
int numberId = 14953
def number = getFieldById("customfield_14953")
def optionsManager = ComponentAccessor.getOptionsManager()
def numberCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(numberId)
def numberConfig = numberCustomField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(numberConfig)
if (instanceValue == "Full"){
def map = ["2 Hours"]
def optionsMap = options.findAll {
it.value in map // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
// error message : number.setFieldOptions(optionsMap)
}
[Static type checking] - Cannot call com.onresolve.jira.groovy.user.FormField#setFieldOptions(java.util.Map <?, java.lang.String>) with arguments [java.util.Map <java.lang.Object, java.lang.Object>]
else {
number.setFieldOptions(options)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.