how to send notification when kb article is going to expire in 15 days and 1 month

vamshi2
Tera Contributor

Hi Team,

please suggest how to configure notification which should trigger 1 month and 15 days before expiry date(valid to) 
notification should  trigger to contributor, approver manger and owner

FYI OOTB we have one month notification but we are not using it

8 REPLIES 8

Hi @Ankur Bawiskar 

the OOTB notification and scheduled job is only for one month and also we have different recipients 

so please suggest how to configure in flow design 

please explain step by  step  or else please suggest the conditions and steps so that i can develop in my flow


@vamshi2 

you can run daily flow at particular time and check whichever KB are expiring in 15 days.

Then use For Each to iterate those records and use "Send Email" flow action

I already shared something for you to get started

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Nilesh Pol
Kilo Sage

@vamshi2 You can make use Scheduled job by navigating to: System Definition - Scheduled Jobs - Scheduled Script Executions for daily running.

Tejas Adhalrao
Tera Guru

Hi @vamshi2  , i have implemented similar requirement 

 

System Definition → Scheduled Script Executions → New

 

Run Daily

 

use this script

 

var gr = new GlideRecord('kb_knowledge');
gr.addNotNullQuery('valid_to');
gr.query();

while (gr.next()) {

    var validTo = new GlideDateTime(gr.valid_to);
    var today = new GlideDateTime();

    var diff = validTo.getNumericValue() - today.getNumericValue();

    var fifteenDays = 15 * 24 * 60 * 60 * 1000;
    var oneMonth    = 30 * 24 * 60 * 60 * 1000;

    // 15 days before expiry
    if (diff > 0 && diff <= fifteenDays && !gr.u_15_days_notified) {

        gs.eventQueue('expiry.15.days', gr);
        gr.u_15_days_notified = true;
        gr.update();
    }

    // 1 month before expiry
    else if (diff > fifteenDays && diff <= oneMonth && !gr.u_1_month_notified) {

        gs.eventQueue('expiry.1.month', gr);
        gr.u_1_month_notified = true;
        gr.update();
    }
}

 

 

 

then 

 

Create 2 Events: name

expiry.15.days

expiry.30days

and now for (duplicate notification ) 

create 2 check boxes on table ( this is required to validate for that record notification sent)

 -   u_15_days_notified
 -     u_1_month_notified

 

 

and then create the notification which will trigger by the event