Hello guys!
I am using a Behavior for a Multi-select custom field from Elements Connects (nFeed) so that, in some projects, it is possible to select only one option from the various ones available.
Behavior works perfectly on the editing screens, however, I was unable to make it work on the issue creation screen.
Here is the code:
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import groovy.json.*
@BaseScript FieldBehaviours fieldBehaviours
def projectKey = underlyingIssue.getProjectObject().key
def cfSigla = getFieldById("customfield_10301")
def cfSiglaValue = cfSigla.getValue().toString()
def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText(cfSiglaValue)
assert object instanceof Map
assert object.inputValues instanceof List
if(projectKey != 'SPAC'){
if(object.inputValues.size() > 1){
cfSigla.setError("error message.")
}else if (object.inputValues.size() <= 1){
cfSigla.clearError()
}
}