Using Custom Fields With the Coveo for Salesforce Free Edition

Free edition only - Deprecated

When creating a search page using Coveo for Salesforce, it’s common to want to include custom Salesforce fields as part of your implementation.

When creating its schema of the available objects and fields from your Salesforce organization, the Coveo Search API takes your custom fields into account. It’s this schema that allows Coveo to know which objects and fields can be queried in a search page.

You can use your custom fields in a Coveo-powered search page using the following syntax, where you replace SalesforceApiName with your field Salesforce API name:


Custom fields usually end with __c.

When adding a custom field to a Knowledge article, you must ensure that the objecttype that you query is the actual Knowledge object, not KnowledgeArticleVersion.

You want to create a facet from your CustomField custom field, in your Knowledge Articles tab that only displays articles from the Knowledge__kav object.

In your search interface, the expression you use for your tab is @objecttype==(Knowledge__kav), while the field used for your facet is @sfCustomField__c.

When using Lightning Knowledge, you should always refer to your Knowledge object instead of KnowledgeArticleVersion.

However, after creating a new custom field, you might notice that you’re unable to use it to query in your Coveo-powered search page. This is because the Salesforce schema has not been updated in the Coveo Search API yet.

There are two ways to make a custom field searchable.

  • Wait 24 hours. The schema of your Salesforce objects and fields is updated daily.

  • Trigger the Search API to add your custom field to its schema.

    1. Wait from 15 minutes to 6 hours after the creation of your custom field. During that time, you should not query using Coveo so the old schema can timeout.

    2. In a Coveo-powered search page, search for your field.

      You created a new custom field called MyCustomField. Because it’s a custom field, its Salesforce API name is MyCustomField__c.

      In a Coveo-powered search page, in the query box, you enter @sfmycustomfield__c, which isn’t expected to return any results.

      If, at this point, your query returns results that include your new field, then it was already added to the Coveo Search API schema.

    3. Wait up to a minute, giving the Coveo Search API time to update the schema.

    4. Perform the search again. You should now have results for your field.

What's Next for Me?