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/5] 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/5] 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/5] 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); From de22e6d04881e9b99532bb0853414d3840f4e264 Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Fri, 3 Oct 2025 11:21:51 -0500 Subject: [PATCH 4/5] Update incompleteChkListShowErrMsg.js --- .../Validate Checklist items/incompleteChkListShowErrMsg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js b/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js index 33d4294af0..0a57399cea 100644 --- a/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js +++ b/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js @@ -1,4 +1,5 @@ -//Business Rule: before update on the escalation table (custom) +//Business Rule: before update on the incident table +//Condition: changing state to 'In Progress' (function executeRule(current, previous /*null when async*/) { var checklistGR = new GlideRecord("checklist"); checklistGR.addQuery("document", current.sys_id); From c7353172981dcef9aa39412b4e337e580cdf16c7 Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Fri, 3 Oct 2025 14:17:04 -0500 Subject: [PATCH 5/5] Update incompleteChkListShowErrMsg.js --- .../Validate Checklist items/incompleteChkListShowErrMsg.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js b/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js index 0a57399cea..f05bc4dc92 100644 --- a/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js +++ b/Server-Side Components/Business Rules/Validate Checklist items/incompleteChkListShowErrMsg.js @@ -14,7 +14,6 @@ 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);