notification when knowledge block retire

Priyansh_98
Tera Guru

i want to send notification to knowledge article author, after attaching knowledge block into the knowledge article ,if the knowledge block is retire a notification should be sent to knowledge article author. for sending that notification which table i should create the notification?

4 REPLIES 4

Ratnakar7
Mega Sage
Mega Sage

Hi @Priyansh_98 ,

 

you can create a Business Rule on the Knowledge Block [kb_knowledge_block] table that checks the 'Retired' field for changes. When the 'Retired' field changes to 'true', you can get the author of the knowledge article using the 'kb_knowledge' reference field on the knowledge block record, and then send a notification to the author using a Notification.

Here are the general steps to implement this:

  1. Create a new Business Rule on the [kb_knowledge_block] table.
  2. Set the When field to 'After' and the Choose field to 'Update'.
  3. In the Advanced field, add the following condition to check if the Retired field has changed to true:

 

if(current.retired.changesTo(true)) {
    // add code to send notification
}

 

 

      4. Inside the condition, retrieve the knowledge article author using the 'kb_knowledge' reference field on the knowledge block record. You can use GlideRecord to query the knowledge article record and get the author's details. Here is an example:

 

var knowledgeBlock = current; // current is the knowledge block record
var knowledgeArticle = new GlideRecord('kb_knowledge');
if(knowledgeArticle.get(knowledgeBlock.kb_knowledge)) {
    var author = knowledgeArticle.getValue('author');
    // add code to send notification to author
}

 

 

      5. To send the notification, you can create a new Notification and set the Recipients field to the author's email address or user ID. You can also customize the notification message and add any relevant information about the retired knowledge block.

 

If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.

 

Thank you!

Ratnakar

Hi @Ratnakar7 ,

thanks for you response.

i want to send notification to article author with some additional derails like knowledge block number ,  block title,retired by and retired date etc. to implement this what should i do?

Hi @Priyansh_98 ,

 

To include additional details in the notification sent to the knowledge article author when a knowledge block is retired, you can create a new notification in the Notification.

-> Set the condition to trigger the notification when a knowledge block is retired. You can refer the following condition:

Type = "Knowledge Block" ^ Operation = "Retire" ^ Knowledge Article is not empty

-> In the Message section, you can use the message body to include the additional details such as knowledge block number, block title, retired by, and retired date. You can use the following placeholders to dynamically populate the values:

  • ${change_number} for the knowledge block number
  • ${short_description} for the knowledge block title
  • ${sys_created_by} for the user who retired the knowledge block
  • ${sys_updated_on} for the retired date

Here is an example message body:

 

 

Dear ${knowledge_author},

The knowledge block ${change_number} has been retired from the knowledge article ${knowledge_article} by ${sys_created_by} on ${sys_updated_on}.

The details of the retired knowledge block are:

Title: ${short_description}
Number: ${change_number}

Please take appropriate action.

Regards,
ServiceNow

 

 

 

Thanks,

Ratnakar

actually additional details should act as a link so if user wants to check that record simply he can view that by clicking on it.