How to remove or hide comments and star ratings displayed in service portal for KB article section?Once the star rating and comments entered it will store on database. Then remove or hide the comments and ratings displayed below the article.

Rajan3
Mega Expert

Once the star rating and comments submitted means it will store on database.

Once it was stored in database. Then hide or remove the rating and comments being displayed in service portal UI.

1 ACCEPTED SOLUTION

Rajesh Annepak1
Kilo Guru

Hi Ramesh ,



The system property is the place where you can control the visibility of the Star Ratings on the service portal



Property name : glide.knowman.show_star_rating



If you mark the property as False then the Star Rating is disabled



Please Mark Correct/ Helpful , If your query is resolved



Rajesh Kumar Annepaka


View solution in original post

6 REPLIES 6

I've noticed when I did this just now, the five star ratings are hidden from the article view, but still show up in search results and any widget such as Featured Content on the knowledge portal homepage. EDIT: Actually I tried unchecking the box that corresponds to 'glide.knowman.show_star_rating' and also limiting the display to certain roles. When I tested, in both cases the star ratings still show in places besides the article.

I did this via the knowledge properties, not directly editing the glide. Could that be why, or is this how ServiceNow works? Is there another way to hide the star ratings?

Nia McCash
Mega Sage
Mega Sage

HI Ramesh,



If you want to allow users to submit comments BUT you want to hide already submitted comments from being displayed on the Service Portal, you will have to clone and modify the 'KB Article Comments' widget and remove this part from the HTML template:



  <h4 ng-if="data.feedback.length > 0">${Comments}</h4>


  <div ng-if="data.feedback" ng-repeat="feedback in data.feedback" style="margin-bottom: 1em">


      <div style="font-weight: bold">


          <span ng-if="::feedback.user">{{::feedback.user}}</span>


          <span> - <sn-time-ago timestamp="::feedback.sys_created_on" /></span>


          <span ng-if="::feedback.useful">


              <glyph sn-char="thumbs-up" ng-if="::feedback.useful == 'yes'" />


              <glyph sn-char="thumbs-down" ng-if="::feedback.useful == 'no'" />


          </span>


          <span ng-if="feedback.rating"> - </span>


          <uib-rating ng-if="::feedback.rating" ng-model="::feedback.rating" max="5" readonly="true" aria-label="${Article rating} - ${Read Only}" />


      </div>


      <span class="break-word" style="white-space: pre-wrap">{{::feedback.comments}}</span>


  </div>



and this part from the Server Script:



data.feedback = [];


if (data.isValid && data.allowFeedback)


data.feedback = getFeedback(data.sys_id);




// private functions


function getFeedback(articleID) {


  var feedback = [];


  var gr = new GlideRecord("kb_feedback");


  gr.addQuery("article", articleID);


gr.addNotNullQuery("comments");


  gr.orderByDesc('sys_created_on');


  gr.query();


  while (gr.next()) {


      var f = {};


      add('comments');


      add('rating');


      add('user');


      add('useful');


      add('sys_created_on');


      feedback.push(f);


  }




  return feedback;




  function add(name) {


      if (gr[name].getED().isDateType())


          f[name] = gr.getValue(name);


      else


          f[name] = gr[name].getDisplayValue();


  }


}