How to hide KB article comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 12:25 AM
Hello,
EDIT: Original question was "How to hide KB article comments in portal view". I managed to hide the comments of other users in Portal but I need to do this for ITIL/Self Service view as well AND knowledge admins should view all comments.
We have a requirement to hide the comments field in the KB article view in portal.
Current set up is all comments can be viewed by all end users.
User should still be able to comment but can only view their own comment. They should not be able to view the comments of others. --> this is already working
Only the admin and knowledge_admin can view all comments.
I have read this article: Hide User Comments on KB Articles -- I already tried to modify UI Macro kb_view_feedback and glide.knowman.show_user_feedback system property to 0 but none worked.
Should this be modified in the widgets? I'm new to scripting so any help is much appreciated!
EDIT: I managed to display only the comments made by the user in our portal but this is also the scenario for knowledge_admin users -- which should not be the case because the knowledge admins should see all comments. Found this in our widget:
// private functions
function getFeedback(articleID) {
var feedback = [];
var gr = new GlideRecord("kb_feedback");
gr.addQuery("article", articleID);
gr.addQuery("comments", '!=', '');
gr.addEncodedQuery('userDYNAMIC'+gs.getUserID()); //added this line
gr.orderByDesc('sys_created_on');
gr.query();
while (gr.next()) {
var f = {};
add('comments');
add('user');
add('sys_created_on');
feedback.push(f);
}
return feedback;
Thank you in advance!
- Alison
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 02:50 AM
Hi Alison,
Can you try setting roles to this system property "glide.knowman.show_user_feedback.roles" as admin and check only admins are able to view comments on portal
Place comma separated roles in that property value
Description: Enter role names exactly as they appear in User Administration > Roles. If the Show user comments on knowledge articles property is selected, users with the roles listed here see user comments in article view.
Are you referring to this place highlighted
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 01:51 AM
Hi,
You can achieve this scenario with two ways one
1. Create Read ACL and provide a role as "admin"
2. Create UI policy and select run-in portal
Mark ✅ Correct if my response solves your issue and also mark 👍 Helpful if you find my answer helps you based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2020 02:32 AM
Hello Shantharao,
Thanks for the reply!
I tried this setup:
Run scripts in: All
Execute if true:
function onCondition() {
var isUserKAdmin = g_user.isMemberOf('group1.sysID'); //knowledge_admin group
var isUserLead = g_user.isMemberOf('group2'); //leads group
if (!isUserKAdmin || !isUserLead)
g_form.setDisplay('comments',false);
}
Unfortunately, this also did not work both for Portal and ITIL view.
Regards,
Alison
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2021 08:00 AM
Hi Alison,
"User should still be able to comment but can only view their own comment. They should not be able to view the comments of others. --> this is already working"
Can you please explain that how did you hide users comments from other users but one who have entered the comment can only see the comment!!