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 that Change state = "Implement"
4. task_ci is the relationship table that links tasks to configuration items (ci_item)
5. Finds all relationship records where the task field equals this Change Request
6. Retrieve the CI whose sys_id is stored in ciRel.ci_item, It returns true if found.
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