From 975bd8293444a8652b06e630af08537aa033e57a Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:10:36 -0500 Subject: [PATCH 1/3] Create README.md --- Server-Side Components/Business Rules/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Server-Side Components/Business Rules/README.md diff --git a/Server-Side Components/Business Rules/README.md b/Server-Side Components/Business Rules/README.md new file mode 100644 index 0000000000..ff4afbb271 --- /dev/null +++ b/Server-Side Components/Business Rules/README.md @@ -0,0 +1,13 @@ +A business rule that verifies all checklist items are completed before allowing the record to progress to the next status. + +The business rule consists of three main parts: + +Part A: Looks up all checklists (checklist table) tied to the current record (document = current.sys_id). + +Part B: For each checklist, query the checklist_item records: + + Only items in that checklist. + + Only items that are not complete (complete = false). + +Part C: If any incomplete items exist, an error message is displayed and the action is aborted. From 888aa74638d55b52127d6737336e8f0c2acbf544 Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:12:39 -0500 Subject: [PATCH 2/3] Rename Server-Side Components/Business Rules/README.md to Server-Side Components/Business Rules/Validate Checklist items/README.md --- .../Business Rules/{ => Validate Checklist items}/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server-Side Components/Business Rules/{ => Validate Checklist items}/README.md (100%) diff --git a/Server-Side Components/Business Rules/README.md b/Server-Side Components/Business Rules/Validate Checklist items/README.md similarity index 100% rename from Server-Side Components/Business Rules/README.md rename to Server-Side Components/Business Rules/Validate Checklist items/README.md From 9f038943f49abacfaa977b4d0a1377049dc70356 Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:24:13 -0500 Subject: [PATCH 3/3] incompleteChkListShowErrMsg.js --- .../incompleteChkListShowErrMsg.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js diff --git a/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js b/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js new file mode 100644 index 0000000000..33d4294af0 --- /dev/null +++ b/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js @@ -0,0 +1,19 @@ +//Business Rule: before update on the escalation table (custom) +(function executeRule(current, previous /*null when async*/) { + var checklistGR = new GlideRecord("checklist"); + checklistGR.addQuery("document", current.sys_id); + checklistGR.query(); + + while (checklistGR.next()) { + var itemGR = new GlideRecord("checklist_item"); + itemGR.addQuery("checklist", checklistGR.sys_id); + itemGR.addQuery("complete", false); + itemGR.query(); + + if (itemGR.hasNext()) { + gs.addErrorMessage('Checklist has incomplete items. Please complete all before assigning it back.'); + current.setAbortAction(true); + break; // stop after first failure + } + } +})(current, previous);