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:
[
{
"attested_date": "",
"parent": "",
"operational_status": "7",
"consumer_type": "internal",
"sys_updated_on": "2025-04-28 15:43:02",
"total_vulnerable_items": "",
"u_urgency": "2",
"number": "BSN0002089",
"published_ref": "",
"discovery_source": "",
"first_discovered": "",
"due_in": "",
"used_for": "Production",
"state": "",
"gl_account": "",
"invoice_number": "",
"sys_created_by": "xxxxx",
"warranty_expiration": "",
"vulnerability_risk_score": "",
"owned_by": {
"link": "<LINK>",
"value": "7110acd2eb8a1610e5d8f03dcad0cdee"
},
"checked_out": "",
"sys_domain_path": "/",
"business_unit": "",
"version": "",
"u_description": "<DESCRIPTION>”,maintenance_schedule": "",
"cost_center": "",
"attested_by": "",
"dns_domain": "",
"service_status": "requirements",
"assigned": "",
"life_cycle_stage": "",
"portfolio_status": "pipeline",
"purchase_date": "",
"u_upstream_support_group": "",
"business_need": "",
"delivery_manager": "",
"end_date": "",
"short_description": "<DESCRIPTION>,",
"busines_criticality": "2",
"u_business_contacts": "7110acd2eb8a1610e5d8f03dcad0cdee",
"managed_by": {
"link": "<LINK>",
"value": "763498da4782d210c2fce2d5536d43fc"
},
"stakeholders": "",
"can_print": "false",
"last_discovered": "",
"service_owner_delegate": "",
"sys_class_name": "cmdb_ci_service_business",
"manufacturer": "",
"life_cycle_stage_status": "",
"vendor": "",
"model_number": "",
"u_secondary_routing_group": {
"link": "<LINK>",
"value": "1aff5f883b3a82108368952a85e45a81"
},
"assigned_to": "",
"start_date": "2018-03-29 22:00:00",
"u_billable": "1",
"serial_number": "",
"price_unit": "",
"support_group": {
"link": "<LINK>",
"value": "a96f9fb33bcf8a508733a50c95e45a82"
},
"correlation_id": "",
"unverified": "false",
"attributes": "",
"asset": "",
"u_base_topic": {
"link": "<LINK>"value": "df4b100c3b2d1a108733a50c95e45a28"
},
"skip_sync": "false",
"aliases": "",
"product_instance_id": "",
"u_request_assignment_group": {
"link": "<LINK>",
"value": "a96f9fb33bcf8a508733a50c95e45a82"
},
"attestation_score": "",
"service_level_requirement": "",
"sys_updated_by": "",
"sys_created_on": "2024-11-26 11:23:19",
"sys_domain": {
"link": "<LINK>",
"value": "global"
},
"install_date": "",
"u_meta": "",
"monitoring_requirements": "",
"asset_tag": "",
"user_group": "",
"fqdn": "",
"change_control": {
"link": "<LINK>",
"value": "d566f4daeb6d96108033f1512bd0cdf5"
},
"unit_description": "",
"business_relation_manager": "",
"last_review_date": "",
"u_budget_code": "FCC",
"u_problem_coordinator_group": {
"link": "<LINK>",
"value": "df05bc5aeb6d96108033f1512bd0cdb9"
},
"business_contact": "",
"compatibility_dependencies": "",
"delivery_date": "",
"install_status": "1",
"supported_by": "",
"name": "<NAME>",
"subcategory": "",
"price_model": "per_unit",
"u_tertiary_routing_group": {
"link": "<LINK>",
"value": "549dfc56ebad96108033f1512bd0cdf0"
},
"assignment_group": {
"link": "<LINK>",
"value": "e647781eeb6d96108033f1512bd0cdcf"
},
"managed_by_group": "",
"u_monitoring_routing_group": {
"link": "<LINK>",
"value": "1aff5f883b3a82108368952a85e45a81"
},
"prerequisites": "",
"sys_id": "00a51dea47c25610c2fce2d5536d4345",
"po_number": "",
"checked_in": "",
"sys_class_path": "/!!/!7/!!",
"mac_address": "",
"company": "",
"justification": "",
"department": {
"link": "<LINK>",
"value": "3a3498da4782d210c2fce2d5536d43fc"
},
"checkout": "",
"comments": "",
"cost": "",
"attestation_status": "Not Yet Reviewed",
"sys_mod_count": "1",
"monitor": "false",
"ip_address": "",
"model_id": "",
"duplicate_of": "",
"sys_tags": "",
"u_technical_abbreviation": "fcc",
"cost_cc": "USD",
"order_date": "",
"schedule": "",
"environment": "",
"u_ownership_group": "",
"due": "",
"u_department_lead_service_owner": "",
"attested": "false",
"u_major_incident_commander": {
"link": "<LINK>",
"value": "40753eb13be516508733a50c95e45a60"
},
"u_teamlead_service_owner": {
"link": "<LINK>",
"value": "c8e450de4782d210c2fce2d5536d43e2"
},
"location": "",
"category": "",
"fault_count": "0",
"lease_id": "",
"service_classification": "Business Service"
}
] From your code, it appears you are trying to invoke an external REST service.
The main problem appears to be that the date is not being parsed correctly into JSON format.
Please refer to the approach provided in this ScriptRunner Example code. It provides a straightforward approach to making GET, POST, PUT, and DELETE requests to external services.
Since you are only making a GET request, you will only need to follow the GET request section of the code.
Let me know how it goes.
Thank you and Kind regards,
Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_
thank you for your tip - fetching data with this script works fine!
final externalUrl = "<URL>"
def getResponse = get(externalUrl, "/api/now/v2/table/cmdb_ci_service_business", "")
if (getResponse) {
def responseGetMap = getResponse as Map<String, String>
responseGetMap.each { map ->
log.info(map.value.getAt('name'))
}
}
But is it possible to populate the fetched data ('name') to a custom picker field?
with definition:
or do I have to use another option?
Kind regards,
Harald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.