Trying to create a notification on Configuration Item[cmdb_ci] table referring to Warranty Expiration field

prudhvig
Tera Expert

Hi,

I have to create a notification on the CI table. On that CI table, I have a field named Warranty Expiration. If the warranty is going to expire in the next 30 days, I want it to notify me.

I have created a condition in the builder but unable to receive a notification.

My notification is as follows:

Screenshot (71)_LI.jpg

Condition is : Warranty Expiration is less than 30 Days before Warranty Expiration

Who will Receive column : I have assigned it to me.

Is this condition right or should I change that? Please let me know.

Thanks in advance.

1 ACCEPTED SOLUTION

snehabinani26
Tera Guru

Hi Prudhvi,



It cannot be achieved in this way directly.



Create a Schedule Job(Script execution) place in the code to Glide in the table and fetch the record with the condition.


Now for each record trigger the event.



Define that event in registry.



Use this event in Notification when to send tab.



Eg ---



Schedule job script -- Run daily



var gr = new GlideRecord("cmdb_ci");


gr.addEncodedQuery("warranty_expirationRELATIVEGT@dayofweek@ahead@30");


gr.query();


while(gr.next()){


gs.eventQueue("event_name",gr,"","");


}



Hope this helps you.


View solution in original post

8 REPLIES 8

madanm7786
Mega Guru

Hi Prudhvi,



Create an event and trigger that event from scheduled job and then configure the notification from that event.


Your scheduled job should run on daily basis.




Thanks,


Maddy


Hi madanm7786,



Could you please guide me in achieving this as I am quite new to Servicenow?


snehabinani26
Tera Guru

Hi Prudhvi,



It cannot be achieved in this way directly.



Create a Schedule Job(Script execution) place in the code to Glide in the table and fetch the record with the condition.


Now for each record trigger the event.



Define that event in registry.



Use this event in Notification when to send tab.



Eg ---



Schedule job script -- Run daily



var gr = new GlideRecord("cmdb_ci");


gr.addEncodedQuery("warranty_expirationRELATIVEGT@dayofweek@ahead@30");


gr.query();


while(gr.next()){


gs.eventQueue("event_name",gr,"","");


}



Hope this helps you.


Kyryl Petruk1
Tera Expert

Hi Prudhvi,



If recipients are static (just yourself for example), then you can use Scheduled reports for this.


http://wiki.servicenow.com/index.php?title=Scheduling_and_Publishing_Reports#gsc.tab=0


Create a report that filters CIs with Warranty Expiration before 30 days from now.


Schedule it to run daily / weekly.


Also handy to tick the checkbox "Omit if empty" this way you'll receive the email only if there's at least 1 CI in the report.



Cheers!