From b650c8de4f5cf6a9de6bb2c29a22f257613f9ee5 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 18 Oct 2024 15:13:21 -0700 Subject: [PATCH 1/2] Commited a new instance scan check for verifying isLoading Check in client scripts. --- ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt | 2 +- ...check_a6f17e0e47d156109c6152e1d16d43d5.xml | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 ca8467c41b9abc10ce0f62c3b24bcbaa/update/scan_table_check_a6f17e0e47d156109c6152e1d16d43d5.xml diff --git a/ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt b/ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt index a5813a2..5921a23 100644 --- a/ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt +++ b/ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt @@ -1 +1 @@ -2GmWsJ-o1b3QV3-6URGiSXSMI8C_MGtuzUzllO-E25BLlW8xY3T33MhCEIjrlR3Iagmuub4YikspwkRRYc_er66_c1onVimbRiN2socYSYWwCzxsJwJ_42oE5oqKePrOLryz7_pU_jzxOYRNa0xBvwEidli_M_kIXOSrwXflcA6Y_bMzciNW2YcnLDxK96tAoSooIaBQEw4x7xKxIIE-ejLeYlU6l11ELhmCn_wOXE-PnAkBU643SDLxBxPp8qsDW791X4ZPOM5_iL6U7Bdtrvb6Kn6mcHZNPFLJC8q7IrJ0wv19MuJlQp-Zi0BH9dg-oN6s5cIKOHYFiINFgINPK2wNocUSVJERDkqoHZOCq0T69m0FxKrEh3B4zujM0zgqx0uXCHVDK08hAyEGISYo7xFU6rUBZhBzLtaVLNHmOOlXlka3h9t8B9mEjYaBcInBbwzMwSgmTIYtN_GuwVekOY-L8R6Iz8ni3sNTd7s36vHxzmSKy0KHMRmzLCS7x8ig1LROAn2UWlX_yrv7AUtwSi1ENYOxw7ayF6mCwxU37FECms1bZVOJWpnfZtQH86cSsZc0FNGyswWUFJRi-XIS0fQA-zl7NVpElIJBONXSK_16Y3uTMx-nr3M5zOiQK5VBUN5SsAGfDucfu-VVwM9-O5HUSs_LGuA9J1Pt4xqKj-8 \ No newline at end of file +WxlZrk3tCfYVHk_P7E55adKaUW_gqoyy24ppXoe_69vo--9SyJclWjdUy5AQkY5Ap_mxCkrx2gvrGWKEztSmdYjsA4ae2kZovmnl1WpoJUNyffVi867QMODK6SMwn0UNtdRC8gTv1FbwX3v-kAwkwRrMVqITUc0oqJp3zLDHmyYoQM2T6qV-EG4KiSlwyRmP3dlRKdSG6hawJEEI99CCJvY-wukSHzmbPQfH_G8V9yze8DiZjeTqDdJLWYPG35QHA2HBDB1FBoZEWSv9uhCuYKQKyFa-2NK_8Lqa55PApoY6LgwN6iPEY8s4JyUnCO8D0Fghg8o73gjuITnNh9IUu-YLqeEqJ0CTkwot5zocpLIQv-6fxsYmKdhxsxVi_Mq-iK36MqsjC14OJ343BcC8-HmTWhN53mgYYiaemNVl2kfKgi2CwvDLruj-aalscIT1lsxEDt0Eg7OCfEvLo-VnqO2Fhyn1pczEzV06naJgmeeKBJOVOqW2TGe2bHELdkgHlorijjTcgzZqlWRtWTrrsS46nrNrUPOD4Vd456NflTNsyXSuWBPr2thZ4aM77UKfrzWoWpgbCYq8QPt3MTp907h91ovrgQqpqdLWW2M9e8DxQ6iZUv-7r-Aw8uvIMkFSAJvV1UiYZ3nGZiqjxjH6bKTZjRuQ-2MEEy0eeAPEbeY \ No newline at end of file diff --git a/ca8467c41b9abc10ce0f62c3b24bcbaa/update/scan_table_check_a6f17e0e47d156109c6152e1d16d43d5.xml b/ca8467c41b9abc10ce0f62c3b24bcbaa/update/scan_table_check_a6f17e0e47d156109c6152e1d16d43d5.xml new file mode 100644 index 0000000..58cb94e --- /dev/null +++ b/ca8467c41b9abc10ce0f62c3b24bcbaa/update/scan_table_check_a6f17e0e47d156109c6152e1d16d43d5.xml @@ -0,0 +1,60 @@ + + + true + false + upgradability + type=onChange^scriptNOT LIKEisLoading^EQ + + + + 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. + https://developer.servicenow.com/dev.do#!/guides/xanadu/now-platform/tpb-guide/client_scripting_technical_best_practices + scan_finding + isLoading Check (onChange Client Scripts) + 1 + e.g //Set Assignment Group to CI's support group if assignment group is empty + function onChange(control, oldValue, newValue, isLoading, isTemplate) { + + if (isLoading) + return; + + var ga = new GlideAjax('ciCheck'); + + ga.addParam('sysparm_name', 'getSupportGroup'); + ga.addParam('sysparm_ci', g_form.getValue('cmdb_ci')); + ga.getXML(setAssignmentGroup); + } + + function setAssignmentGroup(response) { + + var answer = response.responseXML.documentElement.getAttribute("answer"); + + g_form.setValue('assignment_group', answer); + } + + 100 + 0 + 1 + + Keep the isLoading Check for onchange client script + scan_table_check + admin + 2024-10-18 22:11:14 + a6f17e0e47d156109c6152e1d16d43d5 + 0 + isLoading Check (onChange Client Scripts) + ca8467c41b9abc10ce0f62c3b24bcbaa + + ca8467c41b9abc10ce0f62c3b24bcbaa + scan_table_check_a6f17e0e47d156109c6152e1d16d43d5 + admin + 2024-10-18 22:11:14 + sys_script_client
+ false +
+ +
From d6575c38a1f7179fac4f61445e1c036985435efc Mon Sep 17 00:00:00 2001 From: snamjosh <38986112+snamjosh@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:16:36 -0700 Subject: [PATCH 2/2] Updated README.md to include new instance scan check --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 2276e10..88eb8ae 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,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: