Understanding Coveo for Salesforce Objects and Fields

When using Coveo for Salesforce in Coveo Cloud V1, see Understanding Coveo for Salesforce Fields.

In Coveo for Salesforce, you often need to reference specific Salesforce objects and fields, either in Result Templates, in a Search Interface, or in custom code you wish to implement.

This page explains the way Coveo transforms the Salesforce objects and fields, so you can reference them more easily.

For more information on how to create queries using objects and fields, see Coveo Cloud Query Syntax Reference.

Salesforce Object Reference

The Salesforce object names stay the same. You can refer to them by using the following syntax. Ensure you use the Salesforce object API name (see Standard Objects and Custom Objects).

@objecttype=="YourSalesforceObject"

Salesforce Field Reference

Coveo adapts the Salesforce field names to ease the implementation and avoid potential confusion with other non-Salesforce fields.

The best and most accurate way of knowing the exact Coveo name for a Salesforce field, as well as its value for a given item, is to access the Content Browser in your Coveo Cloud organization:

Remember to add the @ symbol when referring to a field (see Coveo Cloud Query Syntax Reference).

  1. Access your Coveo Cloud organization.
  2. In the menu the left, select Content > Content Browser.
  3. Depending on your Coveo for Salesforce edition:

    Pro and Enterprise editions only

    1. In the Sources facet on the left, select the Salesforce source you want to inspect.
    2. In the Object Type facet, select the Salesforce object associated to the item or field you want to inspect.
    3. To ensure you can see all available items, select the Preferences button () at the end of the search bar, and check the View all content box.

    Free edition only

    1. In the search bar, enter the following query, changing Your Object with the Salesforce Object API name of the object associated to the item or field you want to inspect.

      @objecttype=="Your Object"
      
    2. To ensure you can see all available items, select the Preferences button () at the end of the search bar, and check the View all content box.

  4. Click one of your items in the result list, and select the Properties icon.

You should now have access to the Coveo field name of each of your items, along with its associated value for the selected item.

Coveo for Salesforce Field Syntax

As a general rule, all Salesforce fields are transformed the following way:

Sf + Relationship + Salesforce API Field Name

  • Sf

    Indicates the field is a Salesforce field.

  • Relationship

    Indicates the parent or child object associated to the field.

    When referring to a parent object, the singular form of the object name is used.

    When referring to a child object, the plural form of the object name is used.

    When the object is a top-level field (has no parent or child relationship), this value is skipped.

    • Since Account is a parent of Case, the field Name from the Account object associated to a case is SfAccountName
    • The Subject field for all the Case objects on an Account is SfCasesSubject
    • The Status field of the Case object is a top-level field, meaning its field is SfStatus
  • Salesforce API Field Name

    Indicates the Salesforce API field name (see Find the API name of a field).

    Remember that custom fields end with __c.

Understanding Object Relationship

Since Coveo fields take the object relationship into account in its syntax, you may want to understand that relationship when referring to those fields.

Top-Level Fields

Top-level fields are fields that are directly associated to an object.

Formula fields are considered top-level fields.

Parent Relationship Fields

Parent relationship fields are many-to-one relationship from a record being queried to another object.

For example, the Account object is a parent of the Case object, as cases belong to an account.

Child Relationship Fields

Child relationship fields are many-to one relationship from one object to a list of other.

For example, the Account object has a Cases child relationship that lists all the cases for any particular account.

When referencing a child relationship in a query, they are expected to return multiple values.

  1. You can use expressions such as @YourChildRelationshipField==value to match documents for which a multi-value field contains the specified value.
  2. When used in facets, each value will appear on a separate line and can be filtered on independently.
  3. When retrieved in query results, the field value will be a string merging all the values, separated by semicolons.
People also viewed