How to hide KB article comments

Alison11
Mega Expert

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.

find_real_file.png

 

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

 

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Alison,

Did you try checking ACL approach?

Try creating READ ACL on that comments field and in script section check whether it is portal or native view

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur,

 

Thanks for the reply!

 

I tried to create a read ACL: kb_feedback.comments

Condition: User (is dynamic) Me

Script: answer = gs.getUser().isMemberOf('group1.sysID'); //knowledge_admins are in group1

 

End users can still see all comments.

 

Regards,
Alison

There is any OOB Acl by which End users are able to see this
Try deactivating that ACL,then you will meet your requirement
Please mark correct and helpful,if it helps you

Hello Amit,

 

Thanks for the reply!

 

Instead of deactivating, I tried to replicate the ACL rule for the table and just added my conditions, which should work as well but unfortunately this also didn't give me the results I needed.

 

Regards,
Alison