How to trigger mail 7 and 15 days before expiry in KB Article?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2023 05:01 AM - edited ‎02-07-2023 05:11 AM
Thanks
Srinu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2023 05:21 AM - edited ‎02-07-2023 05:26 AM
@Sidhu S Hi!
I would suggest you try with a simple Notification first and then try Mail Scripts if the first on works.
1) You can't rely on the out of box scheduled job to warn people of knowledge articles expiring because that only runs once a month and doesn't meet your need of warning them that their article is about to expire in 7 days.
2) You would need to create your own scheduled job script to run (daily?) to check and see if a knowledge article is within 7 days from now or 15 days..
3) The script for can easily be derived from you going to your knowledge articles and filtering the list to show articles with a valid to date after 6 days from now, but also a valid to date before 8 days from now. So...that would pinpoint the "7" days. This makes it so you aren't querying and using a while loop to then decide if it's a relevant article or not...
The script could look like this:
var gr = new GlideRecord('kb_knowledge'); gr.addEncodedQuery("valid_toRELATIVEGT@dayofweek@ahead@6^valid_toRELATIVELT@dayofweek@ahead@8"); gr.query(); while (gr.next()) { gs.eventQueue('name_of_event', gr, gr.author.email, gr.author.manager.email); }
So this would include the author in the parm1 and author's manager in the parm2.
Within your notification, you'd want to set it up to trigger when 'x' event is fired and in the "who to send to" tab, you'd pick parm1 contains recipients, and parm2 contains recipients.
So that's the general idea. Please refer to this as an example and take it from there.
So now when this scheduled job script runs every day...it'll send an email to those people for that article.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please mark it helpful if it helps...
Thanks,
Sonia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2023 05:26 AM
Hi! @Sidhu S
I would suggest you try with a simple Notification first and then try Mail Scripts if the first on works.
1) You can't rely on the out of box scheduled job to warn people of knowledge articles expiring because that only runs once a month and doesn't meet your need of warning them that their article is about to expire in 7 days.
2) You would need to create your own scheduled job script to run (daily?) to check and see if a knowledge article is within 7 days from now or 15 days..
3) The script for can easily be derived from you going to your knowledge articles and filtering the list to show articles with a valid to date after 6 days from now, but also a valid to date before 8 days from now. So...that would pinpoint the "7" days. This makes it so you aren't querying and using a while loop to then decide if it's a relevant article or not...
The script could look like this:
var gr = new GlideRecord('kb_knowledge'); gr.addEncodedQuery("valid_toRELATIVEGT@dayofweek@ahead@6^valid_toRELATIVELT@dayofweek@ahead@8"); gr.query(); while (gr.next()) { gs.eventQueue('name_of_event', gr, gr.author.email, gr.author.manager.email); }
So this would include the author in the parm1 and author's manager in the parm2.
Within your notification, you'd want to set it up to trigger when 'x' event is fired and in the "who to send to" tab, you'd pick parm1 contains recipients, and parm2 contains recipients.
So that's the general idea. Please refer to this as an example and take it from there.
So now when this scheduled job script runs every day...it'll send an email to those people for that article.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please mark it helpful if it helps...
Thanks,
Sonia