Notification for an Expiring Knowledge Article

cnharris1
Kilo Sage

Is there a way to send out a simple notification to the authors of a knowledge article to let them know that their article is about to expire? If so, how would I go about doing that?

1 ACCEPTED SOLUTION

Archana Reddy2
Tera Guru

Hi,

A Scheduled Job can do your work. Try with the below one.

var ka = new GlideRecord('kb_knowledge');
ka.query();
while(ka.next())
{
var exp = new GlideDateTime(ka.exp_date).getDate(); //Considered exp_date as Article Expiry Date
if(exp.addDaysUTC(7)==new GlideDateTime().getDate())
{
gs.eventQueue('your_event_name',ka,gs.getUser()); //Include the recepients you require
}
}

//Running this Scheduled Job daily will send notification 7 days before the ExpiryDate
//You have to create a notification to be triggered when 'your_event_name' is triggered

Hope this helps!

Thanks,

Archana

View solution in original post

10 REPLIES 10

SanjivMeher
Kilo Patron
Kilo Patron

if your recipient is dynamic, for ex, based on author, You can write a scheduler script to identify all the articles expiring in next 7 days and send them a reminder using gs.eventQueue.

 

if it is just the knowledge admins, you can also schedule a report, and send a spreadsheet to the Knowledge admins abut expiring.


Please mark this response as correct or helpful if it assisted you with your question.

Thanks Sanjiv for pointing me in the right direction.

Archana Reddy2
Tera Guru

Hi,

A Scheduled Job can do your work. Try with the below one.

var ka = new GlideRecord('kb_knowledge');
ka.query();
while(ka.next())
{
var exp = new GlideDateTime(ka.exp_date).getDate(); //Considered exp_date as Article Expiry Date
if(exp.addDaysUTC(7)==new GlideDateTime().getDate())
{
gs.eventQueue('your_event_name',ka,gs.getUser()); //Include the recepients you require
}
}

//Running this Scheduled Job daily will send notification 7 days before the ExpiryDate
//You have to create a notification to be triggered when 'your_event_name' is triggered

Hope this helps!

Thanks,

Archana

Thanks for the post. I used your script and modified it a bit to. Less rows and easy to manage by using Copy Query from a list filter instead of going through all records in the table.

But since I found your script here, I'll post my script here to if someone would like to use it.

System Scheduler -> Scheduled Jobs

//Running this Scheduled Job daily will send notification 7 days before the ExpiryDate

var ka = new GlideRecord('kb_knowledge');
//valid to on next week and workflow is not retired or outdated
ka.addEncodedQuery('valid_toONNext week@javascript:gs.beginningOfNextWeek()@javascript:gs.endOfNextWeek()^workflow_stateNOT INretired,outdated');
ka.query();

while(ka.next()){
	gs.eventQueue('my_expiring_knowledge_articles', ka, ka.author.email, ka.author.email);
}

 

The email is sent to the author of the article in the params filed.

Cheers!