Knowledge Base Icon

Felipe Vilela1
Tera Contributor

Hello Community!

When someone search for articles the result list shows the icon from the Knowledge Base.

Is there any way OOB to add an icon to the article so it shows on the article list?

I tried this workaround

      https://hi.service-now.com/kb_view.do?sysparm_article=KB0812219

     "Knowledge Article : 

  1. Go to kb_knowledge table.
  2. Create a new column of type IMAGE (label- ICON) on the table and save it.
  3. Create an article and provide an image to it, that you'd like to show on the Portal for that article and save the article."

But it doesn´t work, maybe because the label "icon" has the name "u_icon" associated. I don´t know.

Thanks in advance,

Felipe

 

1 REPLY 1

Allen Andreas
Administrator
Administrator

Hi,

Can you share what you've done?

Those instructions cover the field being u_icon, specifically:

Modify the knowledge_fields section in the Additional Options, JSON  as below.
"knowledge_fields": {
"value": "author,sys_view_count,rating,u_icon",
"displayValue": "author,sys_view_count,rating,u_icon" },

Then covers the angular template too:

Angular Template :

Look for the template kb_result_article_summary in the sp_ng_template table. (https://instance.service-now.com/sp_ng_template.do?sys_id=1c873ab1db12220099f93691f0b8f5c1) 
Modify the section where it renders the image for the article.
<img ng-if="article.meta.knowledgeBaseIcon" alt="" class="kb-icon" ng-src="{{article.meta.knowledgeBaseIcon}}">  to 
<img ng-if="article.meta.knowledgeBaseIcon" alt="" class="kb-icon" ng-src="{{article.meta.u_icon.display_value}}">
3. Add the code <span ng-if="f != 'u_icon'"> above the <ng-switch-default section, to make sure the image name is NOT shown on the portal.
4. Close it appropriately to make sure complete switch is within the new IF.
<span ng-if="f != 'u_icon'">
<span ng-switch-default="" ng-switch="article.meta[f].type">
<span ng-if="!$first" class="dot" aria-hidden="true"> • </span>
<span class="secondary-label hidden-sm hidden-xs" ng-if="c.options.show_secondary_fields_label">{{::article.meta[f].label}} : </span>
<span ng-switch-when="glide_date">
<sn-time-ago timestamp="::article.meta[f].value" /></span>
<span ng-switch-when="glide_date_time">
<sn-time-ago timestamp="::article.meta[f].value" /></span>
<span ng-switch-default="">{{article.meta[f].display_value}} </span>
</span>
</span>

I'd recommend giving it another shot?

https://hi.service-now.com/kb_view.do?sysparm_article=KB0812219

especially since the article was done January of this year, so it's not too old.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!