Creating/Editing a FetchXML Crawling Configuration

FetchXML is a language used to query Microsoft Dynamics 365 databases. It acts as a filter: only the items matching your FetchXML query are retrieved and returned (see Use FetchXML to construct a query). Such a query can be saved and reused in various places in Dynamics.

To use FetchXML to determine what entity content Coveo for Microsoft Dynamics 365 will crawl and index

  1. On the Sources page, select your source (see Sources).
  2. In the Action bar, click More, and then click FetchXml.

    If you’re doing this for the first time, you will be prompted to create a Coveo Source record. In the Source Queries dialog, click Yes.

  3. In the Microsoft Dynamics 365 Coveo Source window that appears:

    1. To add a query:

      • Next to All Coveo Queries, click the grid icon.

      • Click Add New Coveo Query.

    2. To edit a query, double-click the desired query.

  4. In the Coveo Query: New Coveo Query or Coveo Query: [QueryName] window that appears:

    1. Under Parent Source, ensure that the desired source name is displayed.

    2. Under General, in the Name field, enter a name for your query.

    3. Enter query data:

      • Based on an existing view:

        1. Next to Copy Existing View, in the Select an entity drop-down menu, click the desired entity.

        2. In the Select a view drop-down menu that appears, click the desired view.

        3. Click Synchronize.

        4. The Entity and the FetchXml fields should be filled automatically.

      • By filling the following fields:

        1. Under Entity, enter the desired entity type.

          You want to crawl accounts that have certain characteristics, so you enter Account.

        2. Under General, in the FetchXml field, enter your query FetchXML.

           <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
             <entity name="account">
               <attribute name="name" />
               <attribute name="address1_city" />
               <attribute name="primarycontactid" />
               <attribute name="telephone1" />
               <attribute name="accountid" />
               <filter type="and">
                 <condition attribute="primarycontactid" operator="not-null" />
    4. If your FetchXML contains entity aliases, you should rename them with a descriptive name. Field names in Coveo for Microsoft Dynamics 365 are based on these aliases, so abstract and very long names make it difficult to browse content metadata (see Item Properties Panel).

    5. Save your query:

      • If adding a new query, at the top of the page, click Save & Close to save your query and close the window.

      • If editing a query, in the bottom right corner, click the floppy disk icon to save your query. Then, click the Parent Source name to come back to the Coveo Source window.

      Your query should now appear in the Coveo Source window.

  5. In the Coveo Source window, at the top left, click Synchronize. This creates the required fields and mappings in Coveo Cloud for your content to be indexed and displayed appropriately (see Fields Page and Adding and Managing Source Mappings).

  6. Go back to the Coveo Sources page, and then double click the desired source.

  7. In the Edit a Microsoft Dynamics 365 Source panel, click the Entities tab, and then deselect the entity for which you just created a FetchXML query, if not already done (see Entities Tab).

    Entities selected in the Entities tab are crawled by Coveo for Microsoft Dynamics 365 independently from the FetchXML crawling configurations.

    Then, the content retrieved by both of these configurations is indexed. So, you want to make sure that the entity for which you created a FetchXML query is only crawled via this query, and not via the Entities tab configuration.

    If you don’t deselect the entity in the Entities tab, some content will be crawled twice: once via your FetchXML query, and once because it’s included in a selected entity in the Entities tab.

  8. Click Save and Rebuild.

  9. Check the indexed content to ensure that your changes have been correctly implemented.

    If you implemented the FetchXML query above, make sure that only accounts with a value in the Primary Contact field are indexed.

Recommended Articles