From b44af5cf46c709b055050642a9a7629d38dea50a Mon Sep 17 00:00:00 2001 From: srikanthroyal932-cmyk Date: Thu, 23 Oct 2025 16:43:55 +0530 Subject: [PATCH 1/4] Before_BR.js Before Update BR --- .../Before_BR.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Server-Side Components/Business Rules/Prevent closure if change tasks are open/Before_BR.js diff --git a/Server-Side Components/Business Rules/Prevent closure if change tasks are open/Before_BR.js b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/Before_BR.js new file mode 100644 index 0000000000..f6cf2a89ac --- /dev/null +++ b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/Before_BR.js @@ -0,0 +1,14 @@ +function executeRule(current, previous /*null when async*/){ + if(current.close_code){ + var taskGR = new GlideRecord('change_task'); + taskGR.addQuery('change_request', current.sys_id); + taskGR.addQuery('state', '!=', '3') // Adjust as needed + taskGR.query(); + + if (taskGR.hasNext()){ + gs.addErrorMessage('You cannot close this change request until all change tasks are closed.'); + current.setAbortAction(true); // Prevent saving the form + } + } + +})(current, previous); From 6fba9c238c8266e301e8b334be751bc4e4c4b006 Mon Sep 17 00:00:00 2001 From: srikanthroyal932-cmyk Date: Thu, 23 Oct 2025 16:47:01 +0530 Subject: [PATCH 2/4] README.md --- .../Prevent closure if change tasks are open/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md diff --git a/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md new file mode 100644 index 0000000000..883f2ac336 --- /dev/null +++ b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md @@ -0,0 +1,7 @@ +Prevent Closure if the change tasks are open + +1. Create a Before Business Rule. +2. Applicable to Change Request Table. +3. Use Before - Update. +4. Add conditions if required. +5. Apply the script. From 31331752d852bf067a5c889d95fa1ecaac158cc0 Mon Sep 17 00:00:00 2001 From: srikanthroyal932-cmyk Date: Thu, 23 Oct 2025 17:15:04 +0530 Subject: [PATCH 3/4] README.md --- .../Prevent closure if change tasks are open/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md index 883f2ac336..ed01adc894 100644 --- a/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md +++ b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md @@ -2,6 +2,8 @@ Prevent Closure if the change tasks are open 1. Create a Before Business Rule. 2. Applicable to Change Request Table. -3. Use Before - Update. -4. Add conditions if required. -5. Apply the script. +3. Use Before - Update Business Rule. +4. Add filter conditions if required. +5. Apply the Business Rule script. +6. If the change request have the active change tasks are still open then we can't proceed with the submission. +7. If required we can add few more query conditions accordingly. From ad2d74fd5e8dea693acae44554900a6415de4470 Mon Sep 17 00:00:00 2001 From: srikanthroyal932-cmyk Date: Thu, 23 Oct 2025 17:16:34 +0530 Subject: [PATCH 4/4] README.md Updated --- .../Prevent closure if change tasks are open/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md index ed01adc894..cd540ecba9 100644 --- a/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md +++ b/Server-Side Components/Business Rules/Prevent closure if change tasks are open/README.md @@ -6,4 +6,5 @@ Prevent Closure if the change tasks are open 4. Add filter conditions if required. 5. Apply the Business Rule script. 6. If the change request have the active change tasks are still open then we can't proceed with the submission. -7. If required we can add few more query conditions accordingly. +7. If required we can add few more query conditions. +8.