Attaching KA to an incident - Add message in work notes

gnewuser
Tera Contributor

Hi 

 

When a Knowledge article is attached to an incidnet, I would like to add a message in  the work notes specifically.  How do I track that an KA has been added to an incidnet? is there a link table so I can write a business rule on that insert?

5 REPLIES 5

Yashsvi
Kilo Sage

Hi @gnewuser,

please check below link:

https://www.servicenow.com/community/service-operations-workspace/attaching-a-knowledge-article-to-w...

Thank you, please make helpful if you accept the solution. 

gnewuser
Tera Contributor

Thanks Yashsvi , I tried this but I would like to add my custom text as part of the inciden'ts work notes.

SN_Learn
Kilo Patron
Kilo Patron

Hi @gnewuser ,

 

The relationship between a task(ex: incident) and knowledge is store in the [m2m_kb_task] table.

 

You can write an after insert business rule on [m2m_kb_task] table and if inserted write some notes on the task's work notes.

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Thanks so much for your response. However the business rule on m2m_kb_task table does not write the text I want:

 

1. I had it as a after insert business rule on m2m_kb_table 

2. I have the following code inside the BR and the work notes are not updated

3. I know there is something off , what am I doing incorrect.

 

 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	// current.task.work_notes = "Attached to current incident " + current.kb_knowledge.number;
	current.task.work_notes = "attaching the KB article on an incident" ;
	 

})(current, previous);