|
| 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="sys_script_client">type=onChange^scriptNOT LIKEisLoading^EQ<item display_value="onChange" endquery="false" field="type" goto="false" newquery="false" operator="=" or="false" value="onChange"/> |
| 7 | + <item endquery="false" field="script" goto="false" newquery="false" operator="NOT LIKE" or="false" value="isLoading"/> |
| 8 | + <item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/> |
| 9 | + </conditions> |
| 10 | + <description>The isLoading flag is the simplest way to prevent unnecessary code from taking up browser time. The isLoading flag should be used at the beginning of any script which is not required to run when the form is loading. There is no need to run this script on a form load because the logic would have already run when the field was last changed. </description> |
| 11 | + <documentation_url>https://developer.servicenow.com/dev.do#!/guides/xanadu/now-platform/tpb-guide/client_scripting_technical_best_practices</documentation_url> |
| 12 | + <finding_type>scan_finding</finding_type> |
| 13 | + <name>isLoading Check (onChange Client Scripts)</name> |
| 14 | + <priority>1</priority> |
| 15 | + <resolution_details>e.g //Set Assignment Group to CI's support group if assignment group is empty |
| 16 | + function onChange(control, oldValue, newValue, isLoading, isTemplate) { |
| 17 | + |
| 18 | + if (isLoading) |
| 19 | + return; |
| 20 | + |
| 21 | + var ga = new GlideAjax('ciCheck'); |
| 22 | + |
| 23 | + ga.addParam('sysparm_name', 'getSupportGroup'); |
| 24 | + ga.addParam('sysparm_ci', g_form.getValue('cmdb_ci')); |
| 25 | + ga.getXML(setAssignmentGroup); |
| 26 | + } |
| 27 | + |
| 28 | + function setAssignmentGroup(response) { |
| 29 | + |
| 30 | + var answer = response.responseXML.documentElement.getAttribute("answer"); |
| 31 | + |
| 32 | + g_form.setValue('assignment_group', answer); |
| 33 | + }</resolution_details> |
| 34 | + <run_condition/> |
| 35 | + <score_max>100</score_max> |
| 36 | + <score_min>0</score_min> |
| 37 | + <score_scale>1</score_scale> |
| 38 | + <script><![CDATA[(function (engine) { |
| 39 | +
|
| 40 | + // Add your code here |
| 41 | +
|
| 42 | +})(engine);]]></script> |
| 43 | + <short_description>Keep the isLoading Check for onchange client script</short_description> |
| 44 | + <sys_class_name>scan_table_check</sys_class_name> |
| 45 | + <sys_created_by>admin</sys_created_by> |
| 46 | + <sys_created_on>2024-10-18 22:11:14</sys_created_on> |
| 47 | + <sys_id>a6f17e0e47d156109c6152e1d16d43d5</sys_id> |
| 48 | + <sys_mod_count>0</sys_mod_count> |
| 49 | + <sys_name>isLoading Check (onChange Client Scripts)</sys_name> |
| 50 | + <sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package> |
| 51 | + <sys_policy/> |
| 52 | + <sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope> |
| 53 | + <sys_update_name>scan_table_check_a6f17e0e47d156109c6152e1d16d43d5</sys_update_name> |
| 54 | + <sys_updated_by>admin</sys_updated_by> |
| 55 | + <sys_updated_on>2024-10-18 22:11:14</sys_updated_on> |
| 56 | + <table>sys_script_client</table> |
| 57 | + <use_manifest>false</use_manifest> |
| 58 | + </scan_table_check> |
| 59 | + <sys_translated_text action="delete_multiple" query="documentkey=a6f17e0e47d156109c6152e1d16d43d5"/> |
| 60 | +</record_update> |
0 commit comments