- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 04:22 AM
Hi
We have requirement to query the affected ci in incident table. when i click on the Fill button , I just called the reference qualifier by querying from Script Include . it was taking to long to query the data with filter and populated the CI's.
We have to query the data from 20 classed based on the below condition . when i applied the query it has 35000 records showing and takes to long to show up in Affected CI field.
Filter condition need to be applied on this below.
Is there any way that we can get the query quicker ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 08:49 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 04:36 AM
Hi Shohaib,
I have also worked on similar requirement. I guess it takes times to query as table is big. So You can try to optimize the logic in script include. Can you share logic written in script include or try to optimize it.
Thanks and Regards
Nishu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 05:32 AM
Hi Nishu,
Please help me on this . Here is the Script Include
var Populate_affected_CI = Class.create();
Populate_affected_CI.prototype = {
initialize: function() {},
FilteraffectedCI: function() {
var answer = [];
var CI1 = new GlideRecord('cmdb_ci');
CI1.addEncodedQuery('sys_class_name=cmdb_ci_service^ORsys_class_name=cmdb_ci_service_discovered^ORsys_class_name=cmdb_ci_server^environment=Production^install_status=1^operational_status=1');
CI1.query();
while (CI1.next()) {
answer.push(CI1.sys_id.toString());
}
var CI2 = new GlideRecord('cmdb_ci');
CI2.addEncodedQuery('sys_class_name=u_cmdb_ci_ceep^ORsys_class_name=cmdb_ci_database^ORsys_class_name=cmdb_ci_db_instance^ORsys_class_name=cmdb_ci_oracle_database^ORsys_class_name=cmdb_ci_win_cluster^ORsys_class_name=cmdb_ci_win_cluster_resource^ORsys_class_name=cmdb_ci_netgear^ORsys_class_name=cmdb_ci_lb^ORsys_class_name=cmdb_ci_lb_bigip^ORsys_class_name=cmdb_ci_mainframe_hardware^ORsys_class_name=cmdb_ci_appl_ibm_cics^ORsys_class_name=cmdb_ci_mainframe_lpar^ORsys_class_name=u_cmdb_ci_storage_array^ORsys_class_name=cmdb_ci_san_fabric^ORsys_class_name=cmdb_ci_hardware^ORsys_class_name=cmdb_ci_app_server_websphere^ORsys_class_name=cmdb_ci_appl_ibm_wmq^ORsys_class_name=cmdb_ci_datacenter^ORsys_class_name=cmdb_ci_dns_alias^ORsys_class_name=cmdb_ci_config_file_tracked^ORsys_class_name=cmdb_ci_computer^ORsys_class_name=cmdb_ci_comm^ORsys_class_name=cmdb_ci_printer^ORsys_class_name=u_tcr^ORsys_class_name=cmdb_ci_scanner^ORsys_class_name=cmdb_ci_kubernetes_service^ORsys_class_name=cmdb_ci_kubernetes_cluster^ORsys_class_name=cmdb_ci_kubernetes_node^ORsys_class_name=cmdb_ci_kubernetes_pod^ORsys_class_name=u_cmdb_template_affected_ci^install_status=1^operational_status=1');
CI2.query();
while (CI2.next()) {
answer.push(CI2.sys_id.toString());
}
var CI3 = new GlideRecord('cmdb_ci');
CI3.addEncodedQuery('sys_class_name=u_facilities_change_ci_s^operational_status=1');
CI3.query();
while (CI3.next()) {
answer.push(CI3.sys_id.toString());
}
var CI4 = new GlideRecord('cmdb_ci');
CI4.addEncodedQuery('sys_class_name=cmdb_ci_spkg^ref_cmdb_ci_spkg.u_app_bible=true');
CI4.query();
while (CI4.next()) {
answer.push(CI4.sys_id.toString());
}
return 'sys_idIN' + answer;
},
type: 'Populate_affected_CI'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 08:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 08:35 AM
Hi Nishu,
How to directly return a query? Can you give me one example.
This Affected CI is Dictionary Override