Restricting access to retired knowledge base documents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2012 12:08 AM
When opening articles via their permalink it isn't shown if the article has been retired - hyperlinks from one article to another can then point to retired documents without the reader knowing. For example KB001xxxx is retired, but accessing via the following URL there is no way of knowing this: https://instance.service-now.com/kb_view.do?sysparm_article=KB001xxxx.
Has anyone any ideas of how to get round this?
Many Thanks
Mark
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2012 08:41 AM
I've found a better solution than my previous "before query" script. Remove that script.
Instead, create a client script called "Hide Retired Content". This is an "onLoad" script on the "Knowledge [kb_knowledge]" table. It will present a very nice message to the user when the retired article is opened, and hide all of the other fields and links.
This is in place on demo07.service-now.com today; it will probably be removed by tomorrow when they reclone the demo.
function onLoad() {
var state = g_form.getValue('workflow_state');
if (state == 'retired') {
g_form.showFieldMsg('number','This Knowledge Base Article has been retired.');
g_form.setVisible('topic',false);
g_form.setVisible('category',false);
g_form.setVisible('published',false);
g_form.setVisible('valid_to',false);
g_form.setVisible('article_type',false);
g_form.setVisible('workflow_state',false);
g_form.setVisible('source',false);
g_form.setVisible('roles',false);
g_form.setVisible('direct',false);
g_form.setVisible('display_attachments',false);
g_form.setVisible('image',false);
g_form.setVisible('short_description',false);
g_form.setVisible('text',false);
g_form.setVisible('wiki',false);
hideClientButtons(/Update/);
hideClientButtons(/Mark Public/);
hideClientButtons(/Delete/);
hideTable('related_links_container');
g_form.hideRelatedList('m2m_kb_ci.kb_knowledge');
g_form.hideRelatedList('kb_feedback.article');
}
}
function hideClientButtons(butname) {
var refs = document.getElementsByTagName("BUTTON");
if (refs) {
for (var i=0; i < refs.length; i++) {
var teststr = refs<i>.innerHTML.toString();
if (teststr.match(butname)) {
refs<i>.style.display = 'none';
}
}
}
return true;
}
function hideTable(theClass) {
var refs = document.getElementsByTagName('table');
for (var i=0; i < refs.length; i++) {
if (refs<i>.className == theClass) {
refs<i>.style.display = 'none';
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2012 11:52 AM
Geoff you are a star, thankyou so much for getting me out of a hole.
Works a treat!
🙂