Gravatar for

Question by fsciuto, Dec 2, 2016 11:11 AM

Customize Icons for search results

I would like to import our own icons for search results and assign them based on Type or FileType. How can I achieve this?

Gravatar for

Comment by Jean-François L'Heureux, Dec 2, 2016 1:10 PM


To help us answer your question, can you give:

Which product are you using? Coveo for Sitecore, Coveo for Salesforce, Coveo .Net Front-End… Which version of the Coveo product with build details (Major.Minor.Build)

Thanks, Jeff

Gravatar for

Comment by fsciuto, Dec 6, 2016 6:29 AM

Hello Jeff, I am using Coveo for Salesforce. How can I check my build details? Thanks

Gravatar for

Comment by amoreau, Dec 6, 2016 10:52 AM

Here is how you can identify your Coveo for Salesforce version.

Simply put, in Salesforce, go to Setup and search for/select Installed Packages.

Gravatar for

Comment by fsciuto, Dec 12, 2016 7:51 AM

Thanks amoreau, it is Coveo for Salesforce V2, version 2.32

1 Reply
Gravatar for

Answer by olamothe, Dec 12, 2016 3:43 PM

To get customized icons, what I would suggest is to simply implement your own "helper" inside your template.

Just a simple javascript function that returns a string depending on the object type or file type.

Here's a simple one, that would fetch the icon inside a static ressource in your salesforce organization (using visual force). Feel free to adapt it to your need.

var myIconSelector = function(result) {
    if(result.raw.filetype == 'txt') {
        return '{!URLFOR($Resource.MyIcons, 'my_image.png')';
    if(result.raw.objecttype == 'case') {
        return '{!URLFOR($Resource.MyIcons, 'another_image.png')';

    [.... etc ....]

[..... rest of your search page .....]

< div class='CoveoResultList' >
    < script class='result-template' type='text/underscore' >
          <img src="<%= myIconSelector(obj) %>"/>
    < / script>
< / div >
Ask a question