setting notification email to fire 90 days before expiry date

robertcook
Giga Contributor

Hi All,

I am trying to create an event that will fire a notification to a company 90 days before the expiry of their license. I am new to SNOW and have hit a road block with the scheduled job any help would be appreciated.

5 REPLIES 5

HarshTimes
Tera Guru

HI RObert


Are you doing this in workflow, then you can use the timer activity and send the notification using that.See the below thread that can help you out.


Is it possible to create a notification 7 days before 'Due Date' on a workflow?


I was told to do a scheduled job as the date field that needs to be queried is on over 200 CI's and it needs to run on a daily basis.


HarshTimes
Tera Guru

you can also write a scheduled job that will run daily and check each record on the table where expiry date is. IN servicenow you can you glidedatetime function to get the date before 90 days.


See the script in the below thread that will give you some idea how to create the script.



Re: Sending notification X days prior to a variable date in a task


HarshTimes
Tera Guru

You can check below script.




var lic = new GlideRecord('cmdb_ci'); // put you cmdb table


lic.addQuery('u_date_of_expiry',gs.daysAgo(-5)); // wit this condition add other condtion for which record you want to check the licnese


lic.query();


while (lic.next()) {


gs.eventQueue("YOUR_EVENT_NAME",lic,PARAM1,PARAM2); // YOU CAN PASS THE EMAIL ID LIST IN PARAM1 TO WHOM EMAIL NEED TO SEND



}