Knowledge Article Retired Date configuration

Ballela Siva Te
Tera Contributor

Hi Team,

 

We got a requirement to send automatic mail before 15 days of the valid to date of a Knowledge article.

 

Can you please guide me how can we do it through different ways

 

Regards

Siva Teja B

9 REPLIES 9

M Ismail
Tera Guru

Hi @Ballela Siva Te ,
you can do this by these ways.

  1. Scheduled Job:

    • Create a Scheduled Script Execution job that runs periodically, for example, daily.
    • Write a script that queries the kb_knowledge table for articles where the valid_to date is within 15 days from the current date.
    • For each qualifying article, send an email notification to the relevant recipients.
    • Schedule the job to run at a suitable time, ensuring it runs before the valid-to date for each article.
  2. Business Rule:

    • Create a Business Rule that triggers on the update of a Knowledge article.
    • Write a script that checks if the article's valid_to date is within 15 days from the current date.
    • If it is, trigger an email notification to the relevant recipients.
    • This method provides real-time notification when a Knowledge article's valid_to date is updated within the defined timeframe.
  3. Flow Designer :

    • Use Flow Designer to create a flow that triggers periodically, for example, daily.
    • Add a condition to check if any Knowledge articles have a valid_to date within 15 days from the current date.
    • If true, send an email notification to the relevant recipients.
    • Flow Designer provides a visual, low-code approach to automating processes without the need for scripting.

      Please hit helpful and accept my response as solution if it solved your problem.

Hi @M Ismail ,

 

Can you provide me the script for the scheduled job approach

 

Regards,

Siva Teja B

Hi @Ballela Siva Te ,
Sure, here is a code for it.
You will have to create a email and event and from this code you are firing that event for a article whose valid_to date is exact 15 days from now.

 

function sendRetirementNotification() {
    // Get the current date
    var currentDate = new GlideDateTime();

    // Calculate the date 15 days from today
    var fifteenDaysLater = new GlideDateTime();
    fifteenDaysLater.addDaysUTC(15);

    // Query for Knowledge articles with valid_to date exactly 15 days from today
    var gr = new GlideRecord('kb_knowledge');
    gr.addQuery('valid_to', fifteenDaysLater); // valid_to date exactly 15 days from today
    gr.addQuery('valid_to', '>=', currentDate); // valid_to date is greater than or equal to the current date
    gr.query();

    while (gr.next()) {
    var articleNumber = gr.number;
      gs.eventQueue('email.send', current, articleNumber, "Knowledge Article Retirement Notification");
      // replace the event with your event and pass the proper parameters
    }
}

sendRetirementNotification();

 

Please hit helpful and accept this as a solution if it solved your problem.
Regards,
M.Ismail
 

Sumanth16
Kilo Patron

Hi @Ballela Siva Te , 

 

Please refer below thread:

 A lot of users who revise articles are just helping out and do not need to know what an article is retiring. So with this, we can just have the author and knowledge group managers know which articles are coming up for retirement.

 

https://www.servicenow.com/community/now-platform-articles/flow-designer-demo-automate-knowledge-exp...

 

For sending to the group, the group should have specific criteria to pull into flow designer (or) code. Adding Checkbox (or) Identification checkbox configuration needed on the group.

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,