Guest User

Untitled

a guest
Jan 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. (function executeRule(current, previous /*null when async*/) {
  2.  
  3.  
  4. if (current.state.changesTo(20)) {
  5. preventClose();
  6. }
  7.  
  8. function preventClose(me) {
  9. var incident = new GlideRecord("incident");
  10. incident.addQuery("problem_id", me.sys_id);
  11. incident.query();
  12. while (incident.next()) {
  13.  
  14. if(incident.state != "7"){//here 3 is the value of closed state
  15. gs.addErrorMessage("Related incident is not closed");
  16. current.setAbortAction(true);
  17. }if(current.state == '20'){
  18. current.state = previous.state;
  19. current.update();
  20. }
  21. }
  22. }
  23.  
  24.  
  25.  
  26.  
  27.  
  28. })(current, previous);
Add Comment
Please, Sign In to add comment