Skip to content

Commit 525aff3

Browse files
Script.js
1 parent 06c5594 commit 525aff3

File tree

1 file changed

+15
-0
lines changed
  • Server-Side Components/Business Rules/Set CI to "In Maintenance" on Change start

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function executeRule(current, previous) {
2+
if (previous.state != current.state && current.state == 'implement') {
3+
var ciRel = new GlideRecord('task_ci');
4+
ciRel.addQuery('task', current.sys_id);
5+
ciRel.query();
6+
while (ciRel.next()) {
7+
var ci = new GlideRecord('cmdb_ci');
8+
if (ci.get(ciRel.ci_item)) {
9+
ci.install_status = 4; // In Maintenance
10+
ci.update();
11+
gs.info('CI ' + ci.name + ' moved to In Maintenance.');
12+
}
13+
}
14+
}
15+
})(current, previous);

0 commit comments

Comments
 (0)