Adding Custom Fields to Result Templates

When using Coveo for Salesforce Free, you may want to add custom fields to your result templates.

While you can follow the normal steps to create a result template (see Creating a JavaScript Search Result Template), to be able to display custom fields in your result template, you need to follow these steps:

  1. In the Interface Editor of your search page, select the template you want to modify (see Selecting a JavaScript Search Result Template to Modify).

  2. In the Template Options window, under Fields to request on every query, enter the field name. It’s composed of @sf followed by the Salesforce API name of your field (see Find the API name of a field).

    You want to display your field called MyCustomField, which has the API name MyCustomField__c.

    Under Fields to request on every query, you enter @sfMyCustomField__c.

  3. After entering the field name, select the + icon at the left of the text box. Your field name should now appear under Selected Fields.

  4. Repeat these steps for every custom field you want to display in your result template.

  5. Select Save.

You can now use your custom field in your result template by referencing its field name, usually by using the Field value component (see Organizing Components Within a Search Result Template Grid).

Recommended Articles