Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Notification to be sent when priority upgrade.

anupriya7
Kilo Expert

I want to trigger notification only when priority get upgrade For Example- (P3 to p2 or p1),(p4 to p3 or p2 or p1) like this.

I tried by using CHANGESFrom and CHANGESTo but not working can any one help me with this.

1 ACCEPTED SOLUTION

Hi Anupriya,


It can be done by a single line condition that will check its upgarding or downgrading.If its upgrding then it will fire a event and you will get notification.


Try this script:


Business Rule(After)


Update: Marked True


(function executeRule(current, previous /*null when async*/) {


  var curP=current.priority;


  var preP=previous.priority;


  if(preP>curP){


  gs.addInfoMessage("Priority has been upgraded from"+" "+preP+" to "+curP);


  gs.eventQueue("Incident_priority_upgrade",current,current.caller_id, current.assigned_to);


  }


})(current, previous);


kindly let me know if its resolves your issue.


Mark helpful or correct answer if its applicable.


Thanks,


Farukh


View solution in original post

5 REPLIES 5

This script send an email notification even if we update other field detail. e.g If we updated Description detail then also script gone executed.