Skip to content

Added check for reference to sys_choice table #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ Check if the Choice [sys_choice] table has been extended. This is not supported
### User table should not be extended
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.

### Do not reference sys_choice table
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.

## Category: Performance

### getMessage() called in Client Script
Expand Down
2 changes: 1 addition & 1 deletion ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
zKXVYjmTYdaUi17DjcgoXWtXX_r6CHPBtrSKlLiqj8Eq7u0uljxaXTgwGGgfBb0bZPqDwv3KpiZ5TBgbcB174pIXaw35AnbNe5iXTbargQQgyhTbcg6_oynarqVoW0VaTfI3XajNJZN2mF889Yz-Mcz5YRB7hK80971bWOcMDhb2QnLAXf7U98k4apomHB45owe2g5XuAoqk4zLwGwgV5sl2wcFfhClAfzuL7jhaxwvd37aEx4BCqjLpkKLRcYT5twtMoJbKAJUAz4ry9UwcbCuSK2GS03-2rsSjeNVqh3NBWNFbtBo3I22SJwVEIpg2PQCHYb5f2ztmHLWknivKaVCzE5A1n6VhVKdST14FKs-F6vtsffOko_MgzgN_by3L0mNy8PcWM9S18_B4pLn9wyREtG3i0UIBOXbpmlCWPXKCwEN7CNYYef09UcCgawGqVRPusHj0O7J7tCbs4241UyfS7om4ch3QD2qMro-TlQjdna_S-5ApnBg8rIb8HapfWJOhGril_TMmtYROGcK3suw1kZuJUEiG5NrhH8e0AM1fXAdF6Aed7z0kEH8UF308F_-SqJs5g3dlRa6uAcmZccZsGCCK4-CEWRtpct38F3ly5i1fPkrb9keSSAJ6-ojhemXulA2jWe1eu5I66bGsPbeMIW807BK4B7h2jOLnYXw
CuNEYHj5RbBsjVJxohTMD1xntLLtuzW06YrIQxv_dnuv66Z-CP9Yyz94aT1y6VMee62ueoZ-zoVm79qzmSN0EDnNTIajGUE-L9E8z-wSmPjpDRK6unp5pT-WyQru961HXU1NDT6tYoVYpmHPnC1pxK1hGqlJ5xCFlFjoYHaWTOMQ-jgr2lppwmOLGMGR7znGbC3ffVubbJzVWxZF2A54U5qoSwKmMb-Sl6nBVJvbZz8finGJvOBn8WzxH6DP_rUNqXJ4ZflVbC2EWzi2mlf_jhEvu35jXElgy6I7myTSoOJvWiK8J6arVkKEt1MNTtewGnDrFnAbFFZ53T08x7UafmirFgZuS4MbzwCYGQ_dX9IlcB-5OLXuB1JYApTLKEJnT364IFKOpAgwzZm5F9dhRAYQG6qVRonDCHrXl1ZJ1WFEMgDCksXtQpTcc53Fe-cH348-sbttOrFExqMtN8HmrJxdjJWFQB0WIPnb7BLMIc6qvc0QIfku9KZpHSlse1cttB-pn_l5UM07YLgjoWCB2wvGaLkZdjDOT0MZizytu7SaAs0SFgm4Q2g4p3xTJ9C78cM24TaT0oQ_gIehRDaf-ETeb4XCdMj1hpaRB4PR2JquoRXJvkfZ7bB6l0ahyfDeQvKqk2cmDf0Mt2CKXeALoAOwe3vhtLMTXKOL1NBAjm4
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?><record_update table="scan_table_check">
<scan_table_check action="INSERT_OR_UPDATE">
<active>true</active>
<advanced>false</advanced>
<category>upgradability</category>
<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"/>
<item endquery="false" field="reference" goto="false" newquery="false" operator="=" or="false" value="sys_choice"/>
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
</conditions>
<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>
<documentation_url>https://support.servicenow.com/kb?id=kb_article_view&amp;sysparm_article=KB0813643</documentation_url>
<finding_type>scan_finding</finding_type>
<name>Do not reference sys_choice table</name>
<priority>3</priority>
<resolution_details/>
<run_condition/>
<score_max>100</score_max>
<score_min>0</score_min>
<score_scale>1</score_scale>
<script><![CDATA[(function (engine) {

// Add your code here

})(engine);]]></script>
<short_description>Do not reference sys_choice table</short_description>
<sys_class_name>scan_table_check</sys_class_name>
<sys_created_by>nia.mccash</sys_created_by>
<sys_created_on>2024-09-30 14:30:45</sys_created_on>
<sys_id>cf9d1010c34916908dbc32f1b4013184</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_name>Do not reference sys_choice table</sys_name>
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
<sys_policy/>
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
<sys_update_name>scan_table_check_cf9d1010c34916908dbc32f1b4013184</sys_update_name>
<sys_updated_by>nia.mccash</sys_updated_by>
<sys_updated_on>2024-09-30 14:30:45</sys_updated_on>
<table>item_option_new</table>
<use_manifest>false</use_manifest>
</scan_table_check>
<sys_translated_text action="delete_multiple" query="documentkey=cf9d1010c34916908dbc32f1b4013184"/>
</record_update>
Loading