Scheduled Job Script that will notify user 7 days before the expiry date of knowledge article. Notification should be send to user who created that article and his Manager.

tony22933
Kilo Contributor

Scheduled Job Script that will notify user 7 days before the expiry date of knowledge article. Notification should be send to user who created that article and his Manager.

4 REPLIES 4

Mihir Mohanta
Kilo Sage

1.Create a event in event registry Ex : renew.kb


2.Trigger that event in scheduled job. Scheduled job script should be like this


searchExparyDate();


function searchExparyDate(){


var qrystr = "active=true^valid_toBETWEENjavascript:gs.now()@javascript:gs.daysAgo(-7)";


var expdt = new GlideRecord("kb_knowledge");


expdt.addEncodedQuery(qrystr);


expdt.query();


while(expdt.next()){


gs.eventQueue('renew.kb',expdt,expdt.author,expdt.author.manager);


}


}



3.Create an event based notification and select param1,param2 contains recepient.



Thanks,


Mihir


Chuck Tomasi
Tera Patron

Hi Tony,



Take a look at https://share.servicenow.com and search for Knowledge or Knowledge Expire or Knowledge Renew. I'd include links, but the current release of Jive software doesn't support deep linking on that site at present. This seems to be a common question and I've often contemplated writing my own.


Trupti6
Tera Expert

Hi there,

you can run daily scheduled job and add the below script in scheduled to run it before 7 days to expiry date.

 

var gr = new GlideRecord("kb_knowledge");
gr.addEncodedQuery('workflow_state=published^active=true^valid_toRELATIVEEE@dayofweek@ahead@7');
gr.query();


while(gr.next()){
gs.eventQueue('KM_Reminder',gr);

}

Kailash Bhange
Kilo Sage

Hi There,
I have Created Article to send Notification using Schedule Job, please take a moment to review and update feedback.

Notify using Scheduled JOBS in ServiceNow


https://community.servicenow.com/community?id=community_article&sys_id=1dd55f001b255010ada243f6fe4bcba8

If the article helps you, please mark it as Helpful, Bookmark it, subscribe it and your feedback would be much appreciated.


Thank You!
Regards,
Kailash