Knowledge Template using WIKI TEXT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2015 01:06 AM
FUJI Patch 3
I'm trying to template a basic WIKI Knowledge article but failing to get the WIKI text to come in useably.
1. If the Article Type defaults to HTML then applying a template which says WIKI fails to bring over the text at all.
2. By trial-and-error, IF I pre-alter the Article Type to WIKI AND press the wiki-text button to get an empty text box on screen THEN apply the template I get the text - AND IT HAS BEEN CONVERTED TO HTML - IN THE WIKI BOX! How can this be?
Before I hit HI, has anyone made this work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2015 06:56 AM
Hi Mike,
Have you found a solution to this yet? We've implemented some functionality I can share if you're still looking for a fix.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 03:42 PM
If anyone else stumbles on this. This is still an issue in Geneva Patch 7. Here's what I did to get around it:
- Add a Wiki Template (u_wiki_template) String field to the kb_knowledge table.
- Create a UI Policy that only shows the Wiki Template field if a value is populated, although really it could just be hidden all the time through the UI Policy.
- Create a Client Script, onChange (Wiki Template) that simply populates newValue to the out of the box wiki field. It then clears the Wiki Template field.
Client Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
// Populate the new value over to the template
g_form.setValue('wiki', newValue);
// Remove the value from the template field
g_form.setValue('u_wiki_template', '');
}
The processing happens very quickly and SN is already triggering a re-render of that field when the template is applied so the rendered wiki text is shown immediately when the template is applied.
Now in your templates populate the custom field you created ("Wiki Template") instead of the native wiki field and everything should work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 04:00 PM
If the timing is off and you do want to force a re-render of the wiki text to HTML, you can add the below line to your client script at the end. At least in Geneva... not sure about earlier versions but it doesn't appear to have changed.
new WikiText('kb_knowledge.wiki', 'true', 'false');
Or a better method might be to trigger a click on the element. If you trigger only one click then the wiki field would be open for editing with the text populated from the template. Trigger two in a row and it would trigger a refresh.
// Force a re-render of the template with a click on the element
var wikiEl = gel('toggle.kb_knowledge.wiki');
wikiEl.click();
wikiEl.click();
But these options are a little riskier in that they may break later on.