Skip to content

Commit bd56627

Browse files
bgrk005adminLacah
authored
Instance scan check for Duplicate Update set names (#151)
* Adding new instance scan check to find duplicate names for update sets * Update README.md --------- Co-authored-by: admin <[email protected]> Co-authored-by: Laszlo <[email protected]>
1 parent c17ab54 commit bd56627

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ Update sets with more than 1000 configuration updates should be broken down into
103103
### Updates in wrong update set scope
104104
The scope for Customer Update [sys_update_xml] records should match the scope of the Update Set in which the Customer Update resides. Having a mismatch may cause Update Sets to generate preview errors meaning you cannot commit them until the errors are resolved.
105105

106+
## Duplicate Updat Set Name
107+
Maintain unique names for update set names it will help to track the updates easyly and also very useful to debug any issues.
108+
106109
### Delete orphaned variables
107110
Variables should be used in Catalog Item or a Variable Set. Variables not in use should be deleted.
108111

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
WxlZrk3tCfYVHk_P7E55adKaUW_gqoyy24ppXoe_69vo--9SyJclWjdUy5AQkY5Ap_mxCkrx2gvrGWKEztSmdYjsA4ae2kZovmnl1WpoJUNyffVi867QMODK6SMwn0UNtdRC8gTv1FbwX3v-kAwkwRrMVqITUc0oqJp3zLDHmyYoQM2T6qV-EG4KiSlwyRmP3dlRKdSG6hawJEEI99CCJvY-wukSHzmbPQfH_G8V9yze8DiZjeTqDdJLWYPG35QHA2HBDB1FBoZEWSv9uhCuYKQKyFa-2NK_8Lqa55PApoY6LgwN6iPEY8s4JyUnCO8D0Fghg8o73gjuITnNh9IUu-YLqeEqJ0CTkwot5zocpLIQv-6fxsYmKdhxsxVi_Mq-iK36MqsjC14OJ343BcC8-HmTWhN53mgYYiaemNVl2kfKgi2CwvDLruj-aalscIT1lsxEDt0Eg7OCfEvLo-VnqO2Fhyn1pczEzV06naJgmeeKBJOVOqW2TGe2bHELdkgHlorijjTcgzZqlWRtWTrrsS46nrNrUPOD4Vd456NflTNsyXSuWBPr2thZ4aM77UKfrzWoWpgbCYq8QPt3MTp907h91ovrgQqpqdLWW2M9e8DxQ6iZUv-7r-Aw8uvIMkFSAJvV1UiYZ3nGZiqjxjH6bKTZjRuQ-2MEEy0eeAPEbeY
1+
BgiovevC1ze9ekbSNu313pR_3YPr9xUl8hAleZQ_Rnfiowfr5T_DAmii6h_xnZewjTA5kJDPZ8x14S0gIPG4eStZ_r0uGIAEaMA2i5ojlbIKORDDapgOMutOHKJaSSwf5uZ0VkEcLzooGIDWB0v16daIWWmH_U_tcnLaTE7bj5lyq4EtAk53xdL2hPu7eGFz949_eZIJg4np37S0xRegM9y_dmXRrQ8sLopLNT_af4u_BCPeNIg9Gwq5Wjn9Qj-xbi8bazd-3t7Koe2HKHH2vqOryT-dhuZufc9zUI_l55ev-4cGovoOeBX2wc13EwKh1HIMaW9kwiWljZ-0An9_loh6WU6FYCcnEV9xS2xDXUbHOoWeuOdg76lvyor5qfEN3jOQ46xXIoW5vidkXaoBVtMSLMcBFbrFBZuJWI0Zq4lZU6TiRvzbveuo1rDeAv126QIJhGCuE0SDcvzuV96dbttSOQ-ZgAUumexHi91tJ_97V2MDP9q5Ms-5Y0Mg9r0PNqCibJqaPEnkxgYPIYePZZZdYPYWbOtM4eTteRkWZxAXO_lRTEq7Bon9z0cpiIRBaZLIg7LiMeLZk8F2gHservOdv1_Y1D_rFznoMifC65doHeUJMmIqw6u6vCAM7C9B8YpsXDLWfL6sPrSqTQwVK1WHG_lmjTI_4U6Qb1fAgFg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="UTF-8"?><record_update table="scan_table_check">
2+
<scan_table_check action="INSERT_OR_UPDATE">
3+
<active>true</active>
4+
<advanced>true</advanced>
5+
<category>manageability</category>
6+
<conditions/>
7+
<description>Having two Update Sets with the same name in ServiceNow makes it hard to debug and track changes.</description>
8+
<documentation_url/>
9+
<finding_type>scan_finding</finding_type>
10+
<name>Duplicate Updat Set Name</name>
11+
<priority>3</priority>
12+
<resolution_details>Ensure all your Update sets have unique names. Rename any update set with a duplicate name with a unique name</resolution_details>
13+
<run_condition/>
14+
<score_max>100</score_max>
15+
<score_min>0</score_min>
16+
<score_scale>1</score_scale>
17+
<script><![CDATA[(function(finding, current) {
18+
19+
// gs.info(current.api_name);
20+
// gs.info('Checking script Include name: ' + current.api_name);
21+
var ga = new GlideAggregate('sys_update_set');
22+
ga.addQuery('name', current.name);
23+
ga.addQuery('sys_id', '!=', current.sys_id);
24+
ga.addAggregate('COUNT');
25+
ga.query();
26+
ga.next();
27+
28+
if (ga.getAggregate('COUNT') >= 1) {
29+
finding.increment();
30+
finding.count = ga.getAggregate('COUNT');
31+
}
32+
})(finding, current);]]></script>
33+
<short_description>Duplicate Updateset Names</short_description>
34+
<sys_class_name>scan_table_check</sys_class_name>
35+
<sys_created_by>admin</sys_created_by>
36+
<sys_created_on>2024-10-19 11:29:09</sys_created_on>
37+
<sys_id>b68a2d5ac3111210eb11ba2ed40131fa</sys_id>
38+
<sys_mod_count>2</sys_mod_count>
39+
<sys_name>Duplicate Updat Set Name</sys_name>
40+
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
41+
<sys_policy/>
42+
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
43+
<sys_update_name>scan_table_check_b68a2d5ac3111210eb11ba2ed40131fa</sys_update_name>
44+
<sys_updated_by>admin</sys_updated_by>
45+
<sys_updated_on>2024-10-19 11:33:53</sys_updated_on>
46+
<table>sys_update_set</table>
47+
<use_manifest>false</use_manifest>
48+
</scan_table_check>
49+
<sys_translated_text action="delete_multiple" query="documentkey=b68a2d5ac3111210eb11ba2ed40131fa"/>
50+
<sys_es_latest_script action="INSERT_OR_UPDATE">
51+
<id>b68a2d5ac3111210eb11ba2ed40131fa</id>
52+
<sys_created_by>admin</sys_created_by>
53+
<sys_created_on>2024-10-19 11:32:10</sys_created_on>
54+
<sys_id>033b619ac3111210eb11ba2ed40131d0</sys_id>
55+
<sys_mod_count>0</sys_mod_count>
56+
<sys_updated_by>admin</sys_updated_by>
57+
<sys_updated_on>2024-10-19 11:32:10</sys_updated_on>
58+
<table>scan_table_check</table>
59+
<use_es_latest>false</use_es_latest>
60+
</sys_es_latest_script>
61+
</record_update>

0 commit comments

Comments
 (0)