Need to send notification to knowledge owner if knowledge article is 6 months old

girishbabuk99
Tera Contributor

Hi,

 

I have a requirement to trigger notifications to the knowledge owner if a knowledge article is 6 months old. I am looking for a solution to achieve this. Can you please suggest how I can set up this notification system?

4 REPLIES 4

PrashantLearnIT
Tera Sage

HI @girishbabuk99 ,

 

You can create flow for notification for article table which can run in specified duration of time.

 

Not applicable

Hi @girishbabuk99 ,

Please follow the steps mentioned in this Article :

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

Note: this article considers the Valid field, you will have to work with Published field.

 

 

Vaishnavi Lathk
Mega Sage

Hello,

 

  1. Create the Script:
    • In the script section, you need to write a script that finds knowledge articles that are exactly 6 months old and sends a notification to the knowledge owner.

Here's a sample script to get you started:

 

 
(function() {
    // Get the date 6 months ago from today
    var sixMonthsAgo = new GlideDateTime();
    sixMonthsAgo.addMonthsUTC(-6);

    // Create a GlideRecord to query knowledge articles
    var gr = new GlideRecord('kb_knowledge');
    gr.addEncodedQuery('sys_created_onON' + sixMonthsAgo.getDate());
    gr.query();

    // Iterate through the results
    while (gr.next()) {
        // Get the knowledge owner's user record
        var owner = new GlideRecord('sys_user');
        if (owner.get(gr.owner)) {
            // Send an email notification to the owner
            gs.eventQueue('knowledge.article.six_months_old', gr, owner.sys_id, '');
        }
    }
})();

 

2. Create the Email Notification

  1. Navigate to Notifications:

    • In the application navigator, type "Notifications" and click on "Email Notifications".
  2. Create a New Notification:

    • Click on the "New" button to create a new email notification.
  3. Configure the Notification:

    • Name: Give your notification a descriptive name (e.g., "Knowledge Article 6 Months Old").
    • Table: Select "Knowledge [kb_knowledge]".
    • When to send: Select "Event is fired" and choose the event you specified in the script (e.g., knowledge.article.six_months_old).
    • Recipients: Add the Knowledge owner as the recipient.
    • Subject: Provide an appropriate subject for the email (e.g., "Your Knowledge Article is 6 Months Old").
    • Message: Craft the message body to include relevant information. You can use variables to include dynamic content from the knowledge article.

Regards,

Vaishnavi Lathkar

Thanks for suggesting the solution, i have tried this and ran the scheduled script but it is not generating the event