Skip to content

Commit 8bc15bb

Browse files
committed
Created the following three new Table check scan rules.
1 parent c459720 commit 8bc15bb

File tree

4 files changed

+136
-1
lines changed

4 files changed

+136
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2GkIkYTRLHBrnaK0BLk-XjxdsvdTIZ9jJdpNRMX35K_6xuWTi5y1Ry99K-DOjlG11wqAiWwvl7aCdE4ZWrSiATbI0lxnUdQ9WxlKwYNvs1x4VCYSXFOyYvTvKT3kiAZAzCrckOa4Em4EIaQWsrb_I8Hs0bgKv33rj-ePUrlm_eyaKJ2rnW23umP3MLy86FEu-J5jxkDLisX7iqlAtjOoRsUQBweQsMoxupOYvfpdE9hb2_IVDL9CoKdTg80_4ggyJ8PNBz0-61EPdmnU7cRKcwrgivmxrwlsMZRJ1uYb2HSI-uveGE4A7AF1o6mBZIz6ssbtFd7EiA0adaGXD5P15jiG014hPjkYP4HKiiA0_Yjt6wL60LGi3OSCJ9gd8YGeijcceUhadJ8o7-_9kKB87bMrCZLimt0eMOU9IP8roKLd8mrCC7yROA1N93b861zaMf9Rya_aFIMJAxF42hodGemepQf6byCLRA_-rQf6UZS9gCn3BUKuaXq3SQ-zJZRa8abRZPslmATdHB_qc3qD-zHdKaau-2U4IjCX5uN8_zJWyiHrskGbzNbjghd7A0IyCLH5cWiIxHZp41YeMQQhXX0ZQyhH8rnFFviKVQkfU9MEVdpqhBTLKe5B0bM5sXYhejFEzKJayrE0FcpgYQhxsN3AyPQpH5w62LMaCkTbugU
1+
O2Z77o9EFursYt1K07qAJxi1q3toSYYu845IcvgRCRP4mg_d8i7G2DvNCJKO6ugMMGVksnwGH69Ehft-qk2O8iHVVDabTYaW9VKCNnoQcWSVwgxYRcCDy7HuepXLHyPfWsKqfatmB3M2GgXO7DTcACLGNuHcf9vLnMSYe168U5lIa7Tt-_3hiWXYwRNRESs10QXHznJ5kkeQjwbZa7ux3ttV15daavjwyejh6wImpTbsAxPwapNgC-klYerXPNmzqoeb7-QLAZnoQ7pvMywmGKjCdFd-3rX4Bnq3O9IdTdKW5hYgdOpj1rlJBYSLiJ6UyOpE3-OURcENQJjo_AV9wSrubWgIfakHA3jkEPUqb256GiDV0aMOXdWxu2wF3gmxVOZLHYGc3c1orSE8WhdDkTatOBiXSsAcwk4SX25-1g0S5rqD5Hq598i8WJGpUzTEcF5rCZ0LPzsgcaWIlVTKJozgTLPvKEbtfXnXzqtGWeKBTCgU2ewKZpwUJkEw3D4wHvg83WstSNngYClZ9cM3PSi-KhlJLq-nJvCdyRm9o7SBZrwufXwmB72lcC3CaJsvL8ll5qPBfyg0MQUySD8q9az-BkOnqjdYAjBJHwdsN6rtqPGtv8sRQU5iPEQi8rWKrmGGLG404fT-Z9SkAl-iIjX34j3INxlYsgBwJQiQo_w
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 table="sys_update_set">state=in progress^ORstate=complete^EQ<item display_value="In progress" endquery="false" field="state" goto="false" newquery="false" operator="=" or="false" value="in progress"/>
7+
<item display_value="Complete" endquery="false" field="state" goto="false" newquery="false" operator="=" or="true" value="complete"/>
8+
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
9+
</conditions>
10+
<description>Usually, developers mark an updatesets as Ignore if the work done is not required to be promoted or incorrect or irrelavent or due to any other reasons. &#13;
11+
However, at times, some of the developers may use the ignored set for any active work instead of creating new one by updating the state from Ignore to In-Progress. It is not a good practice to do the same. It may case the deployment issues and also makes the troubleshooting process cumbersome.&#13;
12+
It may also impact the deployment and cause issues in case if the state is changed to In-Progress/Completed for the potential ignored sets.</description>
13+
<documentation_url/>
14+
<finding_type>scan_finding</finding_type>
15+
<name>Update set In Progress/Completed previously Ignored</name>
16+
<priority>3</priority>
17+
<resolution_details>It is always good and recommended to create a new updateset instead of using already Ignored updatesets by changing the state from Ignore to In-Progress/Completed.</resolution_details>
18+
<run_condition/>
19+
<score_max>100</score_max>
20+
<score_min>0</score_min>
21+
<score_scale>1</score_scale>
22+
<script><![CDATA[(function (finding, current) {
23+
24+
var usSysId = current.getUniqueValue();
25+
var audit = new GlideRecord('sys_audit');
26+
audit.addEncodedQuery('fieldname=state^tablename=sys_update_set^oldvalue=ignore^newvalue=in progress^ORnewvalue=complete');
27+
audit.addQuery('documentkey', usSysId);
28+
audit.setLimit(1);
29+
audit.query();
30+
31+
if(audit.hasNext()){
32+
finding.increment();
33+
}
34+
35+
})(finding, current);]]></script>
36+
<short_description>Already Ignored Update Set shouldn't be set back to In Pogress/Completed.</short_description>
37+
<sys_class_name>scan_table_check</sys_class_name>
38+
<sys_created_by>admin</sys_created_by>
39+
<sys_created_on>2024-10-30 19:28:34</sys_created_on>
40+
<sys_id>01c1c08ec3a19610afa6fc84e401310d</sys_id>
41+
<sys_mod_count>0</sys_mod_count>
42+
<sys_name>Update set In Progress/Completed previously Ignored</sys_name>
43+
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
44+
<sys_policy/>
45+
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
46+
<sys_update_name>scan_table_check_01c1c08ec3a19610afa6fc84e401310d</sys_update_name>
47+
<sys_updated_by>admin</sys_updated_by>
48+
<sys_updated_on>2024-10-30 19:28:34</sys_updated_on>
49+
<table>sys_update_set</table>
50+
<use_manifest>false</use_manifest>
51+
</scan_table_check>
52+
</record_update>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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>false</advanced>
5+
<category>manageability</category>
6+
<conditions table="sys_script">scriptNOT LIKEfunction^EQ<item endquery="false" field="script" goto="false" newquery="false" operator="NOT LIKE" or="false" value="function"/>
7+
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
8+
</conditions>
9+
<description>In general, an advanced busiess rule will wrap your code in a function, and it is important that this guideline is followed. When code is not enclosed in a function, variable and other objects are avilable to all other server-side scripts. This availability can lead to unexpected consequences that are difficult to troubleshoot.</description>
10+
<documentation_url/>
11+
<finding_type>scan_finding</finding_type>
12+
<name>Always keep code/snippet in functions - Business Rules</name>
13+
<priority>2</priority>
14+
<resolution_details>If you have already written code without function in any business rule, move the code by having the function. &#13;
15+
If you create any new business rule, please ensure to write code inside of a function rather writing it directly in script field.</resolution_details>
16+
<run_condition/>
17+
<score_max>100</score_max>
18+
<score_min>0</score_min>
19+
<score_scale>1</score_scale>
20+
<script><![CDATA[(function (engine) {
21+
22+
// Add your code here
23+
24+
})(engine);]]></script>
25+
<short_description>Keep code in functions - Business Rules</short_description>
26+
<sys_class_name>scan_table_check</sys_class_name>
27+
<sys_created_by>admin</sys_created_by>
28+
<sys_created_on>2024-10-30 18:42:01</sys_created_on>
29+
<sys_id>03173371c3a19610afa6fc84e40131af</sys_id>
30+
<sys_mod_count>1</sys_mod_count>
31+
<sys_name>Always keep code/snippet in functions - Business Rules</sys_name>
32+
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
33+
<sys_policy/>
34+
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
35+
<sys_update_name>scan_table_check_03173371c3a19610afa6fc84e40131af</sys_update_name>
36+
<sys_updated_by>admin</sys_updated_by>
37+
<sys_updated_on>2024-10-30 18:48:42</sys_updated_on>
38+
<table>sys_script</table>
39+
<use_manifest>false</use_manifest>
40+
</scan_table_check>
41+
</record_update>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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>false</advanced>
5+
<category>performance</category>
6+
<conditions table="catalog_script_client">scriptLIKEGlideRecord^EQ<item endquery="false" field="script" goto="false" newquery="false" operator="LIKE" or="false" value="GlideRecord"/>
7+
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
8+
</conditions>
9+
<description>Catalog Client script should be using GlideAjax if you need to make asyc calls to Server to get data from Server. GlideRecord() API shouldn't be used to avoid performance issues.</description>
10+
<documentation_url/>
11+
<finding_type>scan_finding</finding_type>
12+
<name>DO NOT USE GlideRecord API in catalog client script</name>
13+
<priority>2</priority>
14+
<resolution_details>Catalog Client scripts run on browser and they uses either data available on the form or data retrieved from the database.&#13;
15+
Use client data as much as possible to eliminate the need for time-consuming server lookups i.e. GlideRecord.&#13;
16+
The best ways to get data into form/browser from the database are g_scratchpad, and asynchronous GlideAjax lookup</resolution_details>
17+
<run_condition/>
18+
<score_max>100</score_max>
19+
<score_min>0</score_min>
20+
<score_scale>1</score_scale>
21+
<script><![CDATA[(function (engine) {
22+
23+
// Add your code here
24+
25+
})(engine);]]></script>
26+
<short_description>Catalog Client script with GlideRecord API calls</short_description>
27+
<sys_class_name>scan_table_check</sys_class_name>
28+
<sys_created_by>admin</sys_created_by>
29+
<sys_created_on>2024-10-30 18:23:17</sys_created_on>
30+
<sys_id>a8d2377dc3619610afa6fc84e4013135</sys_id>
31+
<sys_mod_count>0</sys_mod_count>
32+
<sys_name>DO NOT USE GlideRecord API in catalog client script</sys_name>
33+
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
34+
<sys_policy/>
35+
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
36+
<sys_update_name>scan_table_check_a8d2377dc3619610afa6fc84e4013135</sys_update_name>
37+
<sys_updated_by>admin</sys_updated_by>
38+
<sys_updated_on>2024-10-30 18:23:17</sys_updated_on>
39+
<table>catalog_script_client</table>
40+
<use_manifest>false</use_manifest>
41+
</scan_table_check>
42+
</record_update>

0 commit comments

Comments
 (0)