I want to send mutiliple notifications on certificate expiry

lakshmi2
Kilo Contributor

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 CriteriaDaysMode
First Email60 DaysAlert
Second Email45 DaysWarning
Third Email30 DaysCritical
There afterEver day from 15days or lessBusiness Critical
1 ACCEPTED SOLUTION

Vipin Murugesan
Kilo Sage

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


View solution in original post

6 REPLIES 6

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


Aka Guglielmo
ServiceNow Employee
ServiceNow Employee

I suggest you to use the "expiration notification" flag into the certificate configuration page.



William