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

ark6
Mega Guru

Hi Anupriya,



Try the below steps



1. Create a event in the event registry


2. Create a notification and select condition to trigger("when event is fired")


3. Select your event in the event name


4. Write a business rule with below conditions


          when: onBefore


          update: checked


          condition: current.priority.changesFrom('3') // send notification if priority changes from high


5. Script


gs.addeventQueue("event_name",current,current.caller_id, current.assigned_to);//parm1 and parm2 values can be changed accordingly



Please hit LIKE or mark Helpful if this helps


Hi,


I am using below code that also sending notification by changing High to low (as it should be only low to high)



if (current.priority.changesFrom(4) && current.priority.changesTo(3) || current.priority.changesTo(2) || current.priority.changesTo(1))


  {


  gs.eventQueue("Incident.priority.upgrade", current, current.caller_id, current.state);


}



if (current.priority.changesFrom(3) && current.priority.changesTo(2) || current.priority.changesTo(1))


  {


  gs.eventQueue("Incident.priority.upgrade", current, current.caller_id, current.state);


}



if (current.priority.changesFrom(2) && current.priority.changesTo(1))


  {


  gs.eventQueue("Incident.priority.upgrade", current, current.caller_id, current.state);


}


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


yes Farukh I have already done by using if (previous.priority > current.priority)


Thanks for your valuable reply.