Send out reminder email if KB article is in a state of "Draft" when it hits 30 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:38 AM
Hi All,
I have a requirement from a customer for when a knowledge article has been in a state of draft for 30 days, that it sends an e-mail to the author to remind them.
Has anyone had a similar requirement? If so how and what was the script?
Many Thanks,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:48 AM
Hi @Luke James ,
Please write the following items to achieve this reminder requirement.
Create a scheduled job with condition checking on last updated date ( 30 days ) and state = draft. If condition matched then trigger and event [ table : sysevent_register] , configure an email notification applied on this event.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:15 AM
Hi @AshishKM,
Thanks very much for your help. Here is my script below. Can you see anything wrong with it?
Many Thanks,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:57 AM
Hi @Luke James ,
Please use the below updated script, i changed the 30day update check query.
Use this script in the background and test the result, this should list all draft KB updated before 30days.
If count are high then configure the setLimit() for testing only.
eventQueue() line is commented , you can uncomment after kb count testing.
var grKB = new GlideRecord("kb_knowledge");
grKB.addQuery("workflow_state=draft");
grKB.addQuery("sys_updated_onRELATIVELT@dayofweek@ago@30");
//grKB.setLimit(100)
grKB.query();
gs.print("Count ->"+grKB.getRowCount());
while(grKB.next()){
gs.print("KB->"+grKB.number +"Updated on ->"+grKB.sys_updated_on+ "State->"+grKB.workflow_state);
//gs.eventQueue('remind.author.reminder',current,grKB.author);
}
For event queue learning, refer the below
https://www.youtube.com/watch?v=jXkGt4iJsnY
-Thanks,
Ashish
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 10:36 AM
Hi @AshishKM ,
Thanks very much for this. This now pretty much works perfectly. But I need it to only trigger the event when the article that has been in a draft state hits exactly 30 days in the system. I think with this query it returns results updated in last 30 days, not exactly 30 days?
Many Thanks,
Luke