Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function executeRule(current, previous /*null when async*/) {
- if (current.state.changesTo(20)) {
- preventClose();
- }
- function preventClose(me) {
- var incident = new GlideRecord("incident");
- incident.addQuery("problem_id", me.sys_id);
- incident.query();
- while (incident.next()) {
- if(incident.state != "7"){//here 3 is the value of closed state
- gs.addErrorMessage("Related incident is not closed");
- current.setAbortAction(true);
- }if(current.state == '20'){
- current.state = previous.state;
- current.update();
- }
- }
- }
- })(current, previous);
Add Comment
Please, Sign In to add comment