
- 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 08:09 AM
Hello tejaswitha,
yes you create one with four different conditions,
since i dont want to miss any records i created four different scripts.
MoreOver ----> you can use background scripts to verify how many records you have.
for eg:
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.print(gr.asset_tag); // to know asset_tag number -----> do replace with your custom field
}
}
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 08:02 AM
I suggest you to use the "expiration notification" flag into the certificate configuration page.
William