Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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".
Original file line number Diff line number Diff line change
@@ -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);
Loading