
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 05:34 AM
I am facing issue with generate multiple notifications.
I have created new event called certificate.expiring for u_certificate_tracking.
Do we need to write business rules or scripts for this table?
I want to send notifications for below 4 conditions..
Trigger Criteria | Days | Mode | |
First Email | 60 Days | Alert | |
Second Email | 45 Days | Warning | |
Third Email | 30 Days | Critical | |
There after | Ever day from 15days or less | Business Critical |
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 06:27 AM
Hi Tejaswitha,
var gr= new GlideRecord('ast_contract'); // lets say this your table
gr.addQuery('active', true);
gr.query();
while (gr.next())
{
var holder = gs.dateDiff(gr.getDisplayValue('u_certificate_tracking'), gs.nowDateTime(), false) ; // change according to your custom field name
holder = holder.split(' ')[0];
if (holder == 60)
{
gs.eventQueue('certificate.expiring.60',gr); // fire an event when it is 60 days
}
}
Note :- 1. create 4 different Notifications and events
2. change the values in if condition (eg: 60,45,30,<=15) and events names for firing other notification
3. create 4 different similar scripts by changing values
suppose if you use if statement and few certificates may expire on 45
and few may 60 so when 1st conditions satisfy it may not look for else condition
4. I created scheduled jobs which runs every day to check this condition and fire notification
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 06:00 AM
Hi Tetaswitha,
You will have to write a schedued job which will query the records which are due for certicate expiry based on time stamp and send the email.
Another approach could be to use workflows.
How to create Approval Reminder Mails. (Simple and Easy Approach)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 06:27 AM
Hi Tejaswitha,
var gr= new GlideRecord('ast_contract'); // lets say this your table
gr.addQuery('active', true);
gr.query();
while (gr.next())
{
var holder = gs.dateDiff(gr.getDisplayValue('u_certificate_tracking'), gs.nowDateTime(), false) ; // change according to your custom field name
holder = holder.split(' ')[0];
if (holder == 60)
{
gs.eventQueue('certificate.expiring.60',gr); // fire an event when it is 60 days
}
}
Note :- 1. create 4 different Notifications and events
2. change the values in if condition (eg: 60,45,30,<=15) and events names for firing other notification
3. create 4 different similar scripts by changing values
suppose if you use if statement and few certificates may expire on 45
and few may 60 so when 1st conditions satisfy it may not look for else condition
4. I created scheduled jobs which runs every day to check this condition and fire notification
PS: Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 07:36 AM
Do I need to right 4 different schedule jobs or is it possible to create single schedule job with 4 conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 07:47 AM
Hello,
I would write one schedule that triggered a notification where the information in the notification is created by an email script.
That way you only need to add script in the email script.
I have a version of this where notifications differ depending on a lot of things in a task record.
With regards
Anton Vettefyr