Removing Access to Retired Knowledge Articles

KindonC
Tera Expert

Colleagues are saving permalinks and opening retired knowledge articles thinking that is it the most current knowledge article. Is there a way to remove access to knowledge articles after they are retired so colleagues are not able to view knowledge articles after they are retired? If so, how would you complete this?

3 REPLIES 3

YaswanthKurre
Giga Guru

HI @KindonC ,

 

Before query BR helps you.

 

refer this: Restricting access to retired knowledge base docum... - ServiceNow Community

 

Thanks,

Yaswanth

Thank you! Looking into this solution now 

KindonC
Tera Expert

This did not assist. I was able to create a client script with the code: 

function onLoad() {
var state = g_form.getValue('workflow_state');
if (state === 'retired') {
g_form.showFieldMsg('number', 'This Knowledge Base Article has been retired.', 'info');

var fieldsToHide = [
'topic', 'category', 'published', 'valid_to', 'article_type',
'workflow_state', 'source', 'roles', 'direct',
'display_attachments', 'image', 'short_description', 'text', 'wiki'
];

fieldsToHide.forEach(function(field) {
g_form.setVisible(field, 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(buttonRegex) {
var buttons = document.getElementsByTagName("button");
if (buttons) {
for (var i = 0; i < buttons.length; i++) {
var label = buttons[i].innerHTML.toString();
if (label.match(buttonRegex)) {
buttons[i].style.display = 'none';
}
}
}
}

function hideTable(className) {
var tables = document.getElementsByTagName('table');
for (var i = 0; i < tables.length; i++) {
if (tables[i].className === className) {
tables[i].style.display = 'none';
}
}
}

 

KindonC_0-1749571425595.png

However, I was unable to block the "copy permalink" from being able to copy and paste in the browser. Is there a way to prevent this from happening?

 

KindonC_1-1749571525702.png