Knowledge driven templates??

We have a requirement to expand on the attached knowledge functionality.

So consider the following scenario: A Service Desk analyst enters an incident description into the short description field and hits the search knowledge button. They find the relevent knowledge article and click the "attach Knowledge" button to copy the knowledge content into the incident work notes field. So far, so good.
We have a requirement for some of the incident form fields to be auto populated e.g. Category, priority, impact based on the knowledge chosen.

My gut reaction would be that we would need to create a template (labeled KB10008 for example)to take care of the auto population and create a script that fires that template based on the the first line of the copy in the short description field e.g. Knowledge article KB10008. But I have no idea of how to create that script or indeed if it is possible.

Would appreciate any ideas?

Thanks


This is possible. The easiest way to do it would probably be to change the value that gets returned to the incident and also the field on the incident form that it gets returned to. You can apply a template in a client script using 'applyTemplate(template_sys_id)' so the trick is getting the sys_id value of the appropriate template. I think the easiest way to do this would be to create a new field on the KB table that referenced the template that should be applied. Then you could return the sys_id of the KB article when you hit the 'Attach to Incident' button. That would allow you to query the KB article and get the associated template sys_id. Then you could apply the template in a client script. Here are the steps you have to take to do this...

1) Navigate to 'System Properties', 'UI Properties' and add 'sys_template' to the property with this description...
'By default any system table (starting with "sys") can't be reported off of.' You need to do this so that you can create a reference field to the 'sys_template' table.

2) Personalize the 'kb_knowledge' form and create a new reference field called 'Apply template'. This field should reference the 'Template' (sys_template) table. This is the field that you need to populate with the template that should be applied for a specific kb article.

3) Personalize the Incident form and add a new reference field called 'KB article'. If there is a possibility that this functionality should be made available to other task types in the future you probably want to add the field at the task level. This field should reference the 'kb_knowledge' table. Because this modification uses client scripting, this field always needs to be on the Incident form for things to work like they should. You may choose to hide this field with a UI Policy though.

4) Navigate to 'Knowledge base', 'Properties' and change the 'Copy attached content into this field' property. You want to return the attached content to the new field you created on the incident table ('u_kb_article').

5) Now the 'Attach to Incident' button will populate the 'KB article' field on the incident with the KB article you are attaching. Using a client script you can access anything about that article and put it on the incident form. Here's an 'onChange' client script that you can put on the incident table to run when the 'KB article' field changes. It populates the 'Comments' field with the KB article text and applies the attached template.

function onChange(control, oldValue, newValue, isLoading) {
  if(newValue == oldValue)
    return;
 
  var article = g_form.getReference('u_kb_article');
  var kbText = "Knowledge article " + article.number + ":\n" + "[code]" + article.text + "[/code]";
  g_form.setValue('comments', kbText);
  if(article.u_attach_template){
    applyTemplate(article.u_attach_template);
  }
}

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.