Skip to content

Commit 7e68567

Browse files
authored
Added check for reference to sys_choice table (#107)
* Added table check for item_option_new table * Update README.md with Do not reference sys_choice table desc * Corrected category for Do not reference sys_choice table desc
1 parent 3f048de commit 7e68567

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ Check if the Choice [sys_choice] table has been extended. This is not supported
161161
### User table should not be extended
162162
Check if the User [sys_user] table has been extended. This is not recommended and can cause problems when a user needs to be in more than one user table.
163163

164+
### Do not reference sys_choice table
165+
The Choice table should not be used as the reference table for a Reference type field. Reference fields store the sys_id of the corresponding record in the reference table and show the specified display value. For example: the caller_id field stores the sys_id of a record from the user table and displays the corresponding name value. This presents a problem when using the sys_choice table, because existing records are deleted and replaced when choices are modified. This causes a new sys_id to be generated for each record in the choice list. So the sys_id stored in the Reference field is no longer a valid value and the reference is broken.
166+
164167
## Category: Performance
165168

166169
### getMessage() called in Client Script
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
zKXVYjmTYdaUi17DjcgoXWtXX_r6CHPBtrSKlLiqj8Eq7u0uljxaXTgwGGgfBb0bZPqDwv3KpiZ5TBgbcB174pIXaw35AnbNe5iXTbargQQgyhTbcg6_oynarqVoW0VaTfI3XajNJZN2mF889Yz-Mcz5YRB7hK80971bWOcMDhb2QnLAXf7U98k4apomHB45owe2g5XuAoqk4zLwGwgV5sl2wcFfhClAfzuL7jhaxwvd37aEx4BCqjLpkKLRcYT5twtMoJbKAJUAz4ry9UwcbCuSK2GS03-2rsSjeNVqh3NBWNFbtBo3I22SJwVEIpg2PQCHYb5f2ztmHLWknivKaVCzE5A1n6VhVKdST14FKs-F6vtsffOko_MgzgN_by3L0mNy8PcWM9S18_B4pLn9wyREtG3i0UIBOXbpmlCWPXKCwEN7CNYYef09UcCgawGqVRPusHj0O7J7tCbs4241UyfS7om4ch3QD2qMro-TlQjdna_S-5ApnBg8rIb8HapfWJOhGril_TMmtYROGcK3suw1kZuJUEiG5NrhH8e0AM1fXAdF6Aed7z0kEH8UF308F_-SqJs5g3dlRa6uAcmZccZsGCCK4-CEWRtpct38F3ly5i1fPkrb9keSSAJ6-ojhemXulA2jWe1eu5I66bGsPbeMIW807BK4B7h2jOLnYXw
1+
CuNEYHj5RbBsjVJxohTMD1xntLLtuzW06YrIQxv_dnuv66Z-CP9Yyz94aT1y6VMee62ueoZ-zoVm79qzmSN0EDnNTIajGUE-L9E8z-wSmPjpDRK6unp5pT-WyQru961HXU1NDT6tYoVYpmHPnC1pxK1hGqlJ5xCFlFjoYHaWTOMQ-jgr2lppwmOLGMGR7znGbC3ffVubbJzVWxZF2A54U5qoSwKmMb-Sl6nBVJvbZz8finGJvOBn8WzxH6DP_rUNqXJ4ZflVbC2EWzi2mlf_jhEvu35jXElgy6I7myTSoOJvWiK8J6arVkKEt1MNTtewGnDrFnAbFFZ53T08x7UafmirFgZuS4MbzwCYGQ_dX9IlcB-5OLXuB1JYApTLKEJnT364IFKOpAgwzZm5F9dhRAYQG6qVRonDCHrXl1ZJ1WFEMgDCksXtQpTcc53Fe-cH348-sbttOrFExqMtN8HmrJxdjJWFQB0WIPnb7BLMIc6qvc0QIfku9KZpHSlse1cttB-pn_l5UM07YLgjoWCB2wvGaLkZdjDOT0MZizytu7SaAs0SFgm4Q2g4p3xTJ9C78cM24TaT0oQ_gIehRDaf-ETeb4XCdMj1hpaRB4PR2JquoRXJvkfZ7bB6l0ahyfDeQvKqk2cmDf0Mt2CKXeALoAOwe3vhtLMTXKOL1NBAjm4
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>upgradability</category>
6+
<conditions table="item_option_new">type=8^reference=sys_choice^EQ<item display_value="Reference" endquery="false" field="type" goto="false" newquery="false" operator="=" or="false" value="8"/>
7+
<item endquery="false" field="reference" goto="false" newquery="false" operator="=" or="false" value="sys_choice"/>
8+
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
9+
</conditions>
10+
<description>The Choice table should not be used as the reference table for a Reference type field. Reference fields store the sys_id of the corresponding record in the reference table and show the specified display value. For example: the caller_id field stores the sys_id of a record from the user table and displays the corresponding name value. This presents a problem when using the sys_choice table, because existing records are deleted and replaced when choices are modified. This causes a new sys_id to be generated for each record in the choice list. So the sys_id stored in the Reference field is no longer a valid value and the reference is broken.</description>
11+
<documentation_url>https://support.servicenow.com/kb?id=kb_article_view&amp;sysparm_article=KB0813643</documentation_url>
12+
<finding_type>scan_finding</finding_type>
13+
<name>Do not reference sys_choice table</name>
14+
<priority>3</priority>
15+
<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>Do not reference sys_choice table</short_description>
26+
<sys_class_name>scan_table_check</sys_class_name>
27+
<sys_created_by>nia.mccash</sys_created_by>
28+
<sys_created_on>2024-09-30 14:30:45</sys_created_on>
29+
<sys_id>cf9d1010c34916908dbc32f1b4013184</sys_id>
30+
<sys_mod_count>0</sys_mod_count>
31+
<sys_name>Do not reference sys_choice table</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_cf9d1010c34916908dbc32f1b4013184</sys_update_name>
36+
<sys_updated_by>nia.mccash</sys_updated_by>
37+
<sys_updated_on>2024-09-30 14:30:45</sys_updated_on>
38+
<table>item_option_new</table>
39+
<use_manifest>false</use_manifest>
40+
</scan_table_check>
41+
<sys_translated_text action="delete_multiple" query="documentkey=cf9d1010c34916908dbc32f1b4013184"/>
42+
</record_update>

0 commit comments

Comments
 (0)