Can you use previous on a notification?

matthew_hughes
Kilo Sage

On a notification, I only want it to trigger if the following conditions are met:

if (previous.getValue('u_cmdb_data_steward.manager') == current.getValue('u_cmdb_data_steward')) {
    answer = true;
}
 
The above query checks if the previous manager of the steward is the current steward. Can you use previous in a notification?
22 REPLIES 22

Hi @Mark Roethof On a business application,  when the Steward field is updated to the line manager of the previous Steward, then a notification email should be sent to the new Steward.

Oke, so in that case you could create a Business Rule that creates an event, and the event trigger a Notification. 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Could the following work:

matthew_hughes_1-1704707037740.png

 

 

matthew_hughes_2-1704707089501.png

I'm wanting to pass the names of the previous owners into a pararmeter

I think something like that could work. Several optimizations possible, like this does not need to run on insert, best practice to add conditions, things like that.

 

Is it on purpose that you want the display value in your event? Just checking. Anyway, triggering the Business Rule you should already see if an event is generated or not.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hello @matthew_hughes ,

Yes this will work.

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.