The following script can be schedule to auto close the standard changes/incidents after 5 days to auto close
var changeGR = new GlideRecord('change_request');
changeGR.addQuery('type', 'Standard');
changeGR.addQuery('state', 0);
changeGR.query();
while(changeGR.next()) {
var dif = gs.calDateDiff(changeGR.sys_updated_on, gs.nowDateTime(), true);
gs.print(changeGR.number);
if(dif >= 5*86400){
changeGR.state = 3;
changeGR.comments = 'Change Request automatically closed after 5 days in the Review state.';
changeGR.active = false;
changeGR.update();
}
}
var changeGR = new GlideRecord('change_request');
changeGR.addQuery('type', 'Standard');
changeGR.addQuery('state', 0);
changeGR.query();
while(changeGR.next()) {
var dif = gs.calDateDiff(changeGR.sys_updated_on, gs.nowDateTime(), true);
gs.print(changeGR.number);
if(dif >= 5*86400){
changeGR.state = 3;
changeGR.comments = 'Change Request automatically closed after 5 days in the Review state.';
changeGR.active = false;
changeGR.update();
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.