Glide List Type Bulk Update values in a field

Nisha30
Kilo Sage

Hello Experts,

 

Any one has done bulk uploads of data in a field of type= Glide List.

 

We need to add more than 200 values and doing manually looks not a better solution.

 

We need to add in Table = "discovery_port_probe"  to field = "Triggered by services" around 200 entry from Table=cmdb_ip_service

 

Nisha30_0-1782462611720.png

 

Anyone has done via scripting ? OR not sure Import sets . 

 

Thanks

9 REPLIES 9

Tanushree Maiti
Tera Patron

Hi @Nisha30 

 

Using Fix script/background script , you can run. 

 

Sample high level code

 

var ipSerGr = new GlideRecord('cmdb_ip_service');
// Query your 200+ IP Services
ipSerGr.query();
var sysIdArray = [];
while (ipSerGr.next()) {
sysIdArray.push(ipSerGr.sys_id.toString());
}
var combinedSysIds = sysIdArray.join(',');

var probeGr = new GlideRecord('discovery_port_probe');
probeGr.addQuery('name', 'YOUR_PROBE_NAME'); // Replace with specific probe criteria if needed
probeGr.query();

while (probeGr.next()) {
probeGr.setValue('triggered_by_services', combinedSysIds);
probeGr.update();
}
gs.info("Glide List successfully populated on discovery_port_probe.");

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Thankyou @Tanushree Maiti 

the script works and i can see the SYS_ID of services in log , However when i update it shows success but they are not added to the field . 

 

Nisha30_0-1782466350060.png

 

Thanks

 

Hi @Nisha30 

 

Check the field type of triggered_by_services .

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Its Glide List

 

Nisha30_0-1782467130657.png

Thanks