From 525aff3a27e731e58d868cda0a48917688bcb5e3 Mon Sep 17 00:00:00 2001 From: srikanthroyal932-cmyk Date: Thu, 30 Oct 2025 12:10:28 +0530 Subject: [PATCH 1/2] Script.js --- .../Script.js" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/Script.js" diff --git "a/Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/Script.js" "b/Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/Script.js" new file mode 100644 index 0000000000..b71b50d6e1 --- /dev/null +++ "b/Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/Script.js" @@ -0,0 +1,15 @@ +(function executeRule(current, previous) { + if (previous.state != current.state && current.state == 'implement') { + var ciRel = new GlideRecord('task_ci'); + ciRel.addQuery('task', current.sys_id); + ciRel.query(); + while (ciRel.next()) { + var ci = new GlideRecord('cmdb_ci'); + if (ci.get(ciRel.ci_item)) { + ci.install_status = 4; // In Maintenance + ci.update(); + gs.info('CI ' + ci.name + ' moved to In Maintenance.'); + } + } + } +})(current, previous); From 1d7a7e0e72984f85d24d59bbd60e658b495450c2 Mon Sep 17 00:00:00 2001 From: srikanthroyal932-cmyk Date: Thu, 30 Oct 2025 12:17:50 +0530 Subject: [PATCH 2/2] README.md --- .../README.md" | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 "Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/README.md" diff --git "a/Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/README.md" "b/Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/README.md" new file mode 100644 index 0000000000..bb5870534d --- /dev/null +++ "b/Server-Side Components/Business Rules/Set CI to \"In Maintenance\" on Change start/README.md" @@ -0,0 +1,9 @@ +Set CI to "In Maintenance" on Change start + +1. Write a Business Rule - After Update +2. Select the Change Request Table +3. Add a Condition when Change state = "Implement" +4. task_ci is the relationship table that links tasks to configuration items (ci_item). +5. Create a GlideRecord object for the CI table. +6. Finds all relationship records where the task field equals this Change Request. +7. Set the CI’s install_status to "In Maintenance".