Skip to content

Created a new instance scan check for client scripts #147

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
merged 3 commits into from
Oct 20, 2024
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ In your JDBC data load configuration, ensure that the 'last run datetime' option
### Use of setWorkflow(false) in business rules will cause unexpected issues
As setWorkflow(false) method will stop the execution of business rules on that particular GlideRecord object, this will result in unexpected behaviour where the execution of business rules skipped. Maintain caution while using this method and perform regression testing to avoid possible risk. It can have noticeable impact on Audit, Journal fields, notifications, SLA engine, workflow, flow engine etc.,

### Make use of isLoading Check (onChange Client Scripts Only)

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


# Additional resources

Please check these additional links for more information and details:
Expand Down
2 changes: 1 addition & 1 deletion ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FFSb285LVQLVwwSy1sN9TSS_xgKMdxMueRetT0HDGeIrQsCSVVqvJzq4M3L_pFYItVzRNDhnJyUVmYX7kiDXTToGUlLA1bTP6qfEDtDOKAjH87dpFAYY0oCn-BigJNe6f5mwNAGVBXr3LuZsGmtUK_ximdlxUEYd2DZxoRROrqzIDgwXIAvh0-j8KEYoBGFnBral4LH5FhuzlJImUAh098OvSvclL5NbEYBf4VBqcQZvIP0u2vboUXo2rJ16Kn3iNtzuxPYimD5mfRTRkV7zFDIUxiwGXxf7ncKbO3VZh7DcKeHkGN1Y1RSR1Q_3KyIwoW0YLyKn22G80MIiVx__BKyrof0MY632nGIwHhAstzV83wEoStOilvUdjSJKPNxx9aAft3baZjboj6P8La47D0rfw5lgqOIHq1TnThxjiAlBctfD78qPrva7lfQmipEPZuFHfrKqJ32T_MbAug2xxmt22tnbKCDBDfw8MUc5v3nprsHYFFewiMuZflFHhISDzjSPs2TIy60TrSISouTfVY-p4IgG_v-eSXage9wzpvjoHQZnMwvZrePEtW62OkG8TmD86uZtWTHlPYo2Prj1OGaXZRGHvd3K4bbdtwOWKq9exXozy83yl_w_U3ich8kLj1LuppKxCmMQVEnPvUSdxqwtkqGidBLqZKTcVLCFqJc
WxlZrk3tCfYVHk_P7E55adKaUW_gqoyy24ppXoe_69vo--9SyJclWjdUy5AQkY5Ap_mxCkrx2gvrGWKEztSmdYjsA4ae2kZovmnl1WpoJUNyffVi867QMODK6SMwn0UNtdRC8gTv1FbwX3v-kAwkwRrMVqITUc0oqJp3zLDHmyYoQM2T6qV-EG4KiSlwyRmP3dlRKdSG6hawJEEI99CCJvY-wukSHzmbPQfH_G8V9yze8DiZjeTqDdJLWYPG35QHA2HBDB1FBoZEWSv9uhCuYKQKyFa-2NK_8Lqa55PApoY6LgwN6iPEY8s4JyUnCO8D0Fghg8o73gjuITnNh9IUu-YLqeEqJ0CTkwot5zocpLIQv-6fxsYmKdhxsxVi_Mq-iK36MqsjC14OJ343BcC8-HmTWhN53mgYYiaemNVl2kfKgi2CwvDLruj-aalscIT1lsxEDt0Eg7OCfEvLo-VnqO2Fhyn1pczEzV06naJgmeeKBJOVOqW2TGe2bHELdkgHlorijjTcgzZqlWRtWTrrsS46nrNrUPOD4Vd456NflTNsyXSuWBPr2thZ4aM77UKfrzWoWpgbCYq8QPt3MTp907h91ovrgQqpqdLWW2M9e8DxQ6iZUv-7r-Aw8uvIMkFSAJvV1UiYZ3nGZiqjxjH6bKTZjRuQ-2MEEy0eeAPEbeY
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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="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"/>
<item endquery="false" field="script" goto="false" newquery="false" operator="NOT LIKE" or="false" value="isLoading"/>
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
</conditions>
<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>
<documentation_url>https://developer.servicenow.com/dev.do#!/guides/xanadu/now-platform/tpb-guide/client_scripting_technical_best_practices</documentation_url>
<finding_type>scan_finding</finding_type>
<name>isLoading Check (onChange Client Scripts)</name>
<priority>1</priority>
<resolution_details>e.g //Set Assignment Group to CI's support group if assignment group is empty&#13;
function onChange(control, oldValue, newValue, isLoading, isTemplate) {&#13;
&#13;
if (isLoading)&#13;
return;&#13;
&#13;
var ga = new GlideAjax('ciCheck');&#13;
&#13;
ga.addParam('sysparm_name', 'getSupportGroup');&#13;
ga.addParam('sysparm_ci', g_form.getValue('cmdb_ci'));&#13;
ga.getXML(setAssignmentGroup);&#13;
}&#13;
&#13;
function setAssignmentGroup(response) {&#13;
&#13;
var answer = response.responseXML.documentElement.getAttribute("answer");&#13;
&#13;
g_form.setValue('assignment_group', answer);&#13;
}</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>Keep the isLoading Check for onchange client script</short_description>
<sys_class_name>scan_table_check</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2024-10-18 22:11:14</sys_created_on>
<sys_id>a6f17e0e47d156109c6152e1d16d43d5</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_name>isLoading Check (onChange Client Scripts)</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_a6f17e0e47d156109c6152e1d16d43d5</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-10-18 22:11:14</sys_updated_on>
<table>sys_script_client</table>
<use_manifest>false</use_manifest>
</scan_table_check>
<sys_translated_text action="delete_multiple" query="documentkey=a6f17e0e47d156109c6152e1d16d43d5"/>
</record_update>
Loading