Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Hide User Comments on KB Articles

billi_lumley
ServiceNow Employee
ServiceNow Employee

For Knowledge v3; how can I display/show the comments box, yet hide previous user comments from non-knowledge_admins?   We want all users to be able to submit comments on an article, however we only want knowledge_admins to be able to view those comments once submitted.

Screen Shot 2016-05-26 at 1.46.51 PM.png

The following knowledge property will either show the comment box and user comments or nothing at all if you dont have the knowledge_admin role.

Screen Shot 2016-05-26 at 1.47.04 PM.png

1 ACCEPTED SOLUTION

billi_lumley
ServiceNow Employee
ServiceNow Employee

Comments controlled by UI Macro kb_view_feedback:



The code that displays the actual comments is this portion:


<div id="comments_section" class="snc-comments-section" style="display:$[displayFeedbackOn];">


<j:while test="${feedbackRecords.next()}">


<div class="snc-kb-comment">


<div class="snc-kb-comment-by">


<img src="images/icons/feedback.gifx" alt="${gs.getMessage('Feedback')}" />


<span class="snc-kb-comment-by-title">$[SP]${gs.getMessage("Posted by")}</span>


<span class="snc-kb-comment-by-user">$[SP]${HTML:feedbackRecords.user.getDisplayValue()}</span>


<span class="snc-kb-comment-by-title">$[SP]${gs.getMessage("on")} </span>


<span class="snc-kb-comment-by-date">$[SP]${feedbackRecords.sys_created_on.getDisplayValue()}</span>


</div>


<div class="snc-kb-comment-by-text"><g2:no_escape>${HTML:kbViewInfo.getFeedbackComment(feedbackRecords)}</g2:no_escape></div>


</div>


</j:while>


</div>



Added condition to check if user does not have knowledge_admin role, then display no comments.


The line immediately following that portion, <g:inline template="kb_view_feedback_entry" /> is what controls the "Leave a comment..." comment entry portion.


View solution in original post

13 REPLIES 13

Manjul Katare
ServiceNow Employee
ServiceNow Employee

Hi Billi,



Try using System property (glide.knowman.show_user_feedback) and set its value to "never"



Refer: http://wiki.servicenow.com/index.php?title=Configuring_Knowledge_Properties#gsc.tab=0



Hope it helps!


-Manjul


If I set that to never, then the user cannot even log a comment.   We still want users to log comments, but not see any comments there were logged unless you are an admin.


billi_lumley
ServiceNow Employee
ServiceNow Employee

Comments controlled by UI Macro kb_view_feedback:



The code that displays the actual comments is this portion:


<div id="comments_section" class="snc-comments-section" style="display:$[displayFeedbackOn];">


<j:while test="${feedbackRecords.next()}">


<div class="snc-kb-comment">


<div class="snc-kb-comment-by">


<img src="images/icons/feedback.gifx" alt="${gs.getMessage('Feedback')}" />


<span class="snc-kb-comment-by-title">$[SP]${gs.getMessage("Posted by")}</span>


<span class="snc-kb-comment-by-user">$[SP]${HTML:feedbackRecords.user.getDisplayValue()}</span>


<span class="snc-kb-comment-by-title">$[SP]${gs.getMessage("on")} </span>


<span class="snc-kb-comment-by-date">$[SP]${feedbackRecords.sys_created_on.getDisplayValue()}</span>


</div>


<div class="snc-kb-comment-by-text"><g2:no_escape>${HTML:kbViewInfo.getFeedbackComment(feedbackRecords)}</g2:no_escape></div>


</div>


</j:while>


</div>



Added condition to check if user does not have knowledge_admin role, then display no comments.


The line immediately following that portion, <g:inline template="kb_view_feedback_entry" /> is what controls the "Leave a comment..." comment entry portion.


So did that work for you? I have the very same requirement and I am struggling to get it. Would you be willing to share the script you used, if it did work? Thanks!