How to set an email notification when expiring/end date is approaching?

skendy
Tera Expert

Hi,

I have a custom table which is in relationship with the pm_project table.

It populates the alert (a kind of critical issue) for the project. The alerts have also two fields: start date & end date.

How to create a notification rule (email type) to let the specific user that the end day is approaching?

I read this similar thread (Knowledge Base Article Expiration Notification), but I wanted to ask if there was any way without event scripting...

Thanks,

Skender

1 ACCEPTED SOLUTION

Form the query on the table and filter and get the sample results.. Once done, copy the query and make use of it in a encoded query.


View solution in original post

18 REPLIES 18

You don't need a extra field for this .. You might have some update business rule to schedule a event that will fire the email in future



gs.eventQueueScheduled("incident.reminder", current, gs.getUserID(), gs.getUserName(), current.u_reminder);



Here you might have the business rule to calculate the date dynamically based on your end date and pass it as the last parameter instead of current.u_remainder. You just need to pass a valid datetime value as the last parameter.. And for sending to the mail to the intended user, make use of parm1 and parm2 of the above event .. Make use of those in the notification to have it dynamically send the emails to the required people ..



Does that answer all of your question ?


Excuse me K, but i am really new to this process...


Here I explain better what I'm doing:


u_management_alert_log is the custom table which has an end date (u_alert_end)



I have built a scheduled job which fires an event (alert.check). And then an email notification is being sent to users/owner of the alerts...


In this case I am chechjikn for alerts expiring in the next 14 days...


(as in trying to follow the knowledge bases articles expiring: https://community.servicenow.com/message/681743#681743)



I clicked 'Execute Now', but with no results!


What do you see wrong?



Here the three screenshots:


schedule_job.png


event.png


notification.png


You haven't really queried anything. Did you ?


ctr.query(); is missing


You are right. I forgot it!


I just added it after ctr.addquery, but still nothing.


I checked and I have alerts which expire within the next 14 days...


I didn't put any condition (just that event is fired) in the email notification because records are already 'selected' from the query in the schedule job.


Change the event triggering line



gs.eventQueue('alert.check',ctr);



Check if the events are getting triggered first in the event logs.