---
original_url: "https://jace.pro/blog/approvals-for-knowledge-and-how-they-dont-work/"
format: markdown
ai_optimized: true
---

Approvals for Knowledge and how they dont work- # Approvals for Knowledge and how they dont work

January 12, 2019 [servicenow ](/tags/servicenow/)[approvals](/tags/approvals/)

  Enable AI AnimationA few days ago Derek was asking about approvals, specifically approvals for Knowledge articles and why they don’t work out of the box. It’s weird and here I’ll go through it. So it seems ServiceNow started to make this work out of the box but just never finished it. Here’s the list of things they did;

Workflow `Knowledge - Approval Publish` creates an approval

- A business rule called `Approval Events (Non-Task)` triggers an event for the state based on the table. So searching for `kb_knowledge.approval.inserted` comes up empty. Here’s the code;

`sendEventsNonTask();

function sendEventsNonTask() {
   if (!current.state.changes()) 
      return;

 var event = current.source_table;
 switch (current.state + "") {    
    case 'cancelled':
       event += ".approval.cancelled";
       gs.eventQueue(event, current, gs.getUserID(), gs.getUserName());
       break;
    case 'requested':
       event += ".approval.inserted";
       gs.eventQueue(event, current, gs.getUserID(), gs.getUserName());
       updateRecord(current, current.approver.getDisplayValue() + " requested to approve task");
   break;
    case 'rejected':
       event += ".approval.rejected";
       gs.eventQueue(event, current, current.state, previous.state);
       updateRecord(current, current.approver.getDisplayValue() + " rejected the task.", 
             current.comments.getJournalEntry(-1));
       notifyMyFriends(current);
       break;
    case 'approved':
       updateRecord(current, current.approver.getDisplayValue() + " approved the task.", 
             current.comments.getJournalEntry(-1));
       break;
    default: 
   }       
 }
 /*Omitted remaining code...*/`
- No notification is built but you could just create a new one based on the template called `change.itil.approve.role`\

Subject: ${sysapproval.sys_class_name} ${sysapproval} Approval Request\

`<div>Short Description: ${sysapproval.short_description}</div>
<div>Priority: ${sysapproval.priority}</div>
<div>Category: ${sysapproval.category}</div>
<div> </div>
<div>
<div><hr /></div>
</div>
<div>${mail_script:change_request_summary}</div>
<div> </div>
<div>Comments:</div>
<div>${sysapproval.description}</div>
<div>
<div><hr /></div>
</div>
<div>${mailto:mailto.approval}</div>
<div>
<div><hr /></div>
</div>
<div>${mailto:mailto.rejection}</div>
<div>
<div><hr /></div>
</div>
<div>Approval Activity:</div>
<div>${mail_script:approval_activity}</div>
<div>
<div><hr /></div>
</div>
<div>Click here to view Approval Request: ${URI}</div>
<div>Click here to view ${sysapproval.sys_class_name}: ${sysapproval.URI}</div>`
- I’d probably start with something like this\

Subject: ${document_id.short_description} ${document_id.number} Approval Request

\`<div>Short Description: ${document_id.short_description}</div>
<div> </div>
<div>
<div><hr /></div>
</div>
<div>${mailto:mailto.approval}</div>
<div>
<div><hr /></div>
</div>
<div>${mailto:mailto.rejection}</div>
<div>
<div><hr /></div>
</div>
<div>Click here to view Approval Request: ${URI}</div>
<div>Click here to view ${document_id.sys_class_name}: ${document_id.URI}</div>`

They made it really close. Just never finished it.

In any case, thanks Derek for the idea for the post.

---
[View this page on GitHub](https://github.com/jacebenson/jace.pro/tree/main/./src/posts/2019/2019-01-12-approvals-for-knowledge-and-how-they-dont-work.md).

[Approvals for Knowledge and how they dont work](https://jace.pro/blog/approvals-for-knowledge-and-how-they-dont-work/) [Jace Benson](https://jace.pro) ![Jace Benson](https://jace.pro/icon-512x512.png)

---

*This content is from Jace Benson's ServiceNow and tech blog at jace.pro*
*Original post: https://jace.pro/blog/approvals-for-knowledge-and-how-they-dont-work/*
