The CreatorCon Call for Content is officially open! Get started here.

KB article expiry warning email

ND7
Kilo Sage

Dear Experts,

 

I am trying to set an email notification. 

Send an Email if the KB article is going to retire in the next 7 days. Even though I have three KB articles expiring in 7 days I email did not trigger.  

Please help! 

Thank you.. 

Is my condition correct? 

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

I just wanted to check-in on this and see if my reply above helped recap everything and guide you Correctly.

If so, please mark my above reply as Correct.

Thanks! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

17 REPLIES 17

ND7
Kilo Sage

Is there a way to create a Business rule instead of Schedule Job to trigger KB expiring after 1 day email 

Yes

We use eventQueue() method.

eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter

  1. Event name. Enclose the event name in quotes.
  2. GlideRecord object, typically current but can be any GlideRecord object from the event's table.
  3. Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
  4. Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
  5. (Optional) Name of the queue to manage the event.

To Trigger Event from business rule, syntax is :

gs.eventQueue('Event_Name',current, param1,param2);

Regards

Prasad

Hello,

Business rules will only run once a record is updated or inserted, essentially...so they will not run daily...on a schedule...to do what you want to do. Hence why the discussion has been around creating a scheduled job script execution and firing the event.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

ND7
Kilo Sage

NOT sure what I am doing wrong Email did not trigger.

 

EVENT REGISTRY

Event name  KB_article_expiry_check

find_real_file.png

 

 

Event Name added

*not sure if I need a condition here

 find_real_file.png

Schedule Job,

find_real_file.png

expire equal to valid_to

find_real_file.png

 

 

 

Hi,

Sorry, your thread here has sort of been all over the place and this really shouldn't need 14+ replies to get you setup.

So I'll recap some stuff here for you:

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.

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...

find_real_file.png

find_real_file.png

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.

find_real_file.png

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 consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!