Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Error on select data for custom picker field

Harald Hiebl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2025

Hi,

I have configured a csutom picker field for data from ServiceNow, but on loading options I get following error:

Error searching: java.lang.UnsupportedOperationException 

java.lang.UnsupportedOperationException
at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:52) at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113) at jdk.proxy1/jdk.proxy1.$Proxy5118.isEmpty(Unknown Source)

My code for the field is:

 

HTTPBuilder getHttpBuilder() {
    new HTTPBuilder("https://xxx.com"
    )
}

search = {
    HttpBuilder.request(Method.GET, ContentType.JSON) {
        headers.Accecpt = 'application/json'
        headers."x-sn-apikey" =  "<TOKEN>"
        uri.path = "/api/now/v2/table/cmdb_ci_service_business"
        uri.query = [fields: 'sys_id, name']
    }
}

toOption = { Map<String, String> map, Closure<String> highlight ->  
    new PickerOption(        
        value: map.sys_id,
        label: map.name,    

        html: highlight(map.sys_id, false)
    )
}

Any idea, why the json object can not be converted to a map?

If I create a separate output for the http request, all data are available:

def output = HttpBuilder.request(Method.GET, ContentType.JSON) {
    headers.Accecpt = 'application/json'
    headers."x-sn-apikey" =  "<TOKEN>"

    uri.path = "/api/now/v2/table/cmdb_ci_service_business"
    uri.query = [fields: 'sys_id, name']      

    response.failure = { null }
}
def bsNumber = output["result"]*."number"
def bsName = output["result"]*."name"
def bsSys = output["result"]*."sys_id"

log.info(bsNumber)
log.info(bsName)
log.info(bsSys)
 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events