--- title: Add a Microsoft Dynamics 365 source slug: '1915' canonical_url: https://docs.coveo.com/en/1915/ collection: index-content source_format: adoc --- # Add a Microsoft Dynamics 365 source Microsoft Dynamics 365 is a customer relationship management typically used by support agents. A Microsoft Dynamics 365 [source](https://docs.coveo.com/en/246/) allows you to index any type of Dynamics entities, including support cases and KB articles. It also supports the Dynamics security scheme so that in the search results, users can only see the [items](https://docs.coveo.com/en/210/) they have access to in Dynamics. See [Coveo, Dynamics, and Security](https://docs.coveo.com/en/448/) for details. > **Leading practice** > > The number of [items](https://docs.coveo.com/en/210/) that a source processes per hour (crawling speed) depends on various factors, such as network bandwidth and source configuration. > See [About crawling speed](https://docs.coveo.com/en/2078/) for information on what can impact crawling speed, as well as possible solutions. ## Source key characteristics The following table presents the main characteristics of a Microsoft Dynamics 365 source. [%header,cols="2,2,2,4"] |=== 2+|Features ^|Supported |Additional information 2+|Microsoft Dynamics 365 Cloud version ^|9 |See Microsoft [Dynamics CRM / Dynamics 365 Updates](https://blogs.msdn.microsoft.com/crminthefield/2013/07/11/microsoft-dynamics-crm-2015-2013-and-2011-update-rollups-and-service-packs-release-dates-build-numbers-and-collateral/). 2+|Indexable content |All available system and custom entities, notes and files attached to records of the indexed entity types, and KB articles (body, comments, and attachments). | .3+|[Content update operations](https://docs.coveo.com/en/2039/) |[refresh](https://docs.coveo.com/en/2710/) ^|[check] |[Takes place every hour by default](https://docs.coveo.com/en/1933/). [Auditing must be enabled](https://docs.coveo.com/en/441/) to take account of deleted items. |[rescan](https://docs.coveo.com/en/2711/) ^|[check] | |[rebuild](https://docs.coveo.com/en/2712/) ^|[check] | .3+|[Content security](https://docs.coveo.com/en/1779/) options |[Same users and groups as in your content system](https://docs.coveo.com/en/1779#same-users-and-groups-as-in-your-content-system) ^|[check] |[Coveo, Dynamics 365, and Security](https://docs.coveo.com/en/448/) |[Specific users and groups](https://docs.coveo.com/en/1779#specific-users-and-groups) ^|[check] | |[Everyone](https://docs.coveo.com/en/1779#everyone) ^|[check] | .3+|[Metadata indexing for search](#index-metadata) |Automatic mapping of [metadata](https://docs.coveo.com/en/218/) to [fields](https://docs.coveo.com/en/200/) that have the same name 2+a|This setting is disabled by default and [not recommended for this source type](https://docs.coveo.com/en/1640#about-the-performfieldmappingusingallorigins-setting). |Automatically indexed [metadata](https://docs.coveo.com/en/218/) 2+a|Examples of [auto-populated default fields](https://docs.coveo.com/en/1833#field-origin) (no user-defined metadata required):   * `clickableuri` * `date` * `filetype` * `title`   After a content update, [inspect your item field values](https://docs.coveo.com/en/2053#inspect-search-results) in the **Content Browser**. |Extracted but not indexed metadata 2+a|The Microsoft Dynamics 365 source extracts the fields you specify in your **Entities to include** configuration as metadata with the `dy` prefix.   After a rebuild, review the [**View and map metadata**](https://docs.coveo.com/en/m9ti0339#view-and-map-metadata-subpage) subpage for the list of indexed metadata, and [index additional metadata](https://docs.coveo.com/en/m9ti0339#index-metadata). |=== ## Add a Microsoft Dynamics 365 source Follow the instructions below to add a Microsoft Dynamics 365 source. . On the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page, click **Add source**. . In the **Add a source of content** panel, click the **Microsoft Dynamics 365** source tile. . Configure your source. > **Leading practice** > > It's best to create or edit your source in your sandbox organization first. > Once you've confirmed that it indexes the desired content, you can copy your source configuration to your production organization, either [with a snapshot](https://docs.coveo.com/en/3239/) or manually. > > See [About non-production organizations](https://docs.coveo.com/en/2959/) for more information and best practices regarding sandbox organizations. ### "Sign in to Microsoft Dynamics" window When adding a source, you must first authenticate with Microsoft Dynamics 365 in the **Sign in to Microsoft Dynamics** window to allow Coveo to access your content. > **Note** > > Your source authentication may eventually fail. > You'll then need to [reauthorize the source](#reauthorize-the-source). . Enter your Microsoft Dynamics 365 instance URL, and then click **Sign In**. . Select a user that's both a Microsoft Dynamics 365 administrator and an Application administrator, and then enter the corresponding password. . Click **Accept** to allow Coveo to access your Dynamics 365 content. ### "Configuration" tab In the **Add a Microsoft Dynamics 365 Source** panel, the **Configuration** tab is selected by default. It contains your source's general and authentication information, as well as other parameters. #### General information ##### Source name Enter a name for your source. > **Leading practice** > > A source name can't be modified once it's saved, therefore be sure to use a short and descriptive name, using letters, numbers, hyphens (`-`), and underscores (`_`). Avoid spaces and other special characters. ##### Discovery Web App URL Enter the Discovery Web App URL of your Microsoft Dynamics 365 instance to be used as the endpoint to connect to the web services used to communicate with the Microsoft Dynamics 365 cloud components. If you don't know your Discovery Web API URL, follow these steps to access this information: . In the Microsoft Dynamics 365 expandable navigation panel at the top, navigate to **Settings** > **Customization** > **Customizations**. . In the **Customization** page, click **Developer Resources**. . Your Discovery Web API endpoint address appears under **Connect your apps to the Dynamics 365 Discovery Service**. ##### Organization unique name Enter the Microsoft Dynamics 365 unique name identifying your organization. This name also appears on the **Developer Resources** page. ##### Project Use the **Project** selector to associate your source with one or more Coveo [projects](https://docs.coveo.com/en/n7ef0517/). #### "Entities to include" section Enter a JSON configuration defining the Dynamics entities and fields to index. You can also specify conditions and relations between entities. See ["Entities to Include" section reference](#entities-to-include-section-reference) for details on how to structure your configuration. #### "Queries to include" section Enter Microsoft Dynamics 365 FetchXML queries in execution order to index specific content. See ["Queries to Include" section reference](#queries-to-include-section-reference) for details on how to structure your configuration. ### "Content security" tab Select who will be able to access the source items through a Coveo-powered [search interface](https://docs.coveo.com/en/2741/). For details on the content security options, see [Content security](https://docs.coveo.com/en/1779/). ### "Access" tab . On the **Access** tab, specify whether each group (and API key, if applicable) in your [Coveo organization](https://docs.coveo.com/en/185/) can view or edit the current source. For example, when creating a new source, you could decide that members of Group A can edit its configuration, while Group B can only view it. For more information, see [Custom access level](https://docs.coveo.com/en/3151#custom-access-level). On the **Access** tab, specify whether each group (and API key, if applicable) in your [Coveo organization](https://docs.coveo.com/en/185/) can view or edit the current source. For example, when creating a new source, you could decide that members of Group A can edit its configuration, while Group B can only view it. For more information, see [Custom access level](https://docs.coveo.com/en/3151#custom-access-level). ### Build the source . Finish adding or editing your source: ** When you're done editing the source and want to make your changes effective, click **Add and build source**/**Save and rebuild source**. ** When you want to save your source configuration changes without starting a build/rebuild, such as when you know you want to make other changes soon, click **Add source**/**Save**. On the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page, click **Launch build** or **Start required rebuild** when you're ready to make your changes effective and index your content. > **Leading practice** > > By default, a Jira Software source indexes the entire Jira Software instance content. > To index only certain projects, click **Save**, and then specify the desired address patterns in your [source JSON configuration](https://docs.coveo.com/en/1685/) before launching the initial build. > See [Add source filters](https://docs.coveo.com/en/2006#add-source-filters) for further information. . On the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page, follow the progress of your source addition or modification. . Once the source is built or rebuilt, [review its content in the Content Browser](https://docs.coveo.com/en/2053/). . Optionally, consider [editing or adding mappings](https://docs.coveo.com/en/1640/). > **Note** > > If you selected **Specific URLs** or **User profiles** in the [**Content**](https://docs.coveo.com/en/1739#content) section, some additional items will appear in the Content Browser. > To retrieve user profiles, Coveo must crawl your SharePoint Online instance, including your host site collection and the documents it contains. > Items encountered during this process are also retrieved and therefore appear in the Content Browser. ### Index metadata To use [metadata](https://docs.coveo.com/en/218/) values in [search interface](https://docs.coveo.com/en/2741/) [facets](https://docs.coveo.com/en/198/) or result templates, the metadata must be [mapped](https://docs.coveo.com/en/217/) to [fields](https://docs.coveo.com/en/200/). Coveo automatically [maps](https://docs.coveo.com/en/217/) only a subset of the metadata it extracts. You must map any additional metadata to fields manually. > **Note** > > Not clear on the purpose of indexing metadata? > Watch [this video](https://www.youtube.com/watch?v=BmmmVJ3AWi0). . On the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page, click your source, and then click **More** > **View and map metadata** in the Action bar. . Review the default [metadata](https://docs.coveo.com/en/218/) that your source is extracting from your content. . Map any currently _not indexed_ metadata that you want to use in facets or result templates to fields. The source extracts the [fields](#fields-array-of-object-required) you specify in your [**Entities to include**](#entities-to-include-section-reference) JSON configuration as metadata with the `dy` prefix. .. Click the metadata and then, at the top right, click **Add to Index**. .. In the **Apply a mapping on all item types of a source** panel, select the field you want to map the metadata to, or [add a new field](https://docs.coveo.com/en/1833#add-a-field) if none of the existing fields are appropriate. > **Note** > > For advanced mapping configurations, like applying a mapping to a specific item type, see [Manage mappings](https://docs.coveo.com/en/1640#manage-mappings). .. Click **Apply mapping**. . Return to the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page. . To reindex your source with your new mappings, click your source, and then click **More** > **Rebuild** in the Action bar. . Once the source is rebuilt, review your item field values. They should now include the values of the metadata you selected to index. .. On the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page, click your source, and then click **More** > **Open in Content Browser** in the Action bar. .. Select the card of the item for which you want to inspect properties, and then click **Properties** in the Action bar. .. In the panel that appears, select the **Fields** tab. ## "Entities to include" section reference Your JSON configuration should be formatted as follows. Each object in this configuration represents a type of Microsoft Dynamics 365 entity to index. ```json [ ... { "name": "entityTypeName", "conditions": [ { "field": "fieldName", "operator": "Equal", "type": "STRING", "values": [ "name" ] } ], "fields": [ { "name": "fieldName" } ], "relations": [ { "name": "linkedEntityTypeName", "fields": [ "fieldName" ], "fromField": "sourceObjectField", "toField": "targetObjectField", "toObject": "linkedObjectName" } ] }, ... ] ``` ### `name` (string, required) The type of the Microsoft Dynamics 365 entity to index. **Example:** `account` ### `conditions` (array of object) Each object in this array represents a condition that an entity must meet to be indexed. **Example:** ```json "conditions": [ { "field": "address1_country", "operator": "Equal", "type": "STRING", "values": [ "canada", "mexico" ] }, { "field": "address1_addresstypecode", "operator": "Null", "type": "UNARY" }, { "field": "address2_latitude", "operator": "GreaterThan", "type": "NUMBER", "values": [ "42" ] } ] ``` #### `field` (string) The Microsoft Dynamics 365 field on which the condition is based. #### `operator` (string) The condition operator. Available operator options are: `Equal`, `NotEqual`, `GreaterThan`, `GreaterEqual` (is greater than or equal to), `LessThan`, `LessEqual` (is less than or equal to), `Contains`, `DoesNotContain`, `BeginsWith`, `DoesNotBeginWith`, `EndsWith`, `DoesNotEndWith`, `Like` (is like), `NotLike` (isn't like), `In` (is included in), `NotIn` (isn't included in), `Null` (doesn't contain data), and `NotNull` (contains data). #### `type` (string) The type of data specified under [values](#values-array-of-string). Available types are: `STRING`, `NUMBER`, and `UNARY`. `UNARY` indicates that no values are expected for this [condition](#conditions-array-of-object) (for example, with the `Null` [operator](#operator-string)). #### `values` (array of string) The [field](#field-string) values to put in relation with the [operator](#operator-string). ### `fields` (array of object, required) Each object in this array is the name of a metadata field to index for the desired entity. Specify at least one field. **Example:** ```json "fields": [ { "name": "accountid" }, { "name": "name" } ] ``` ### `relations` (array of object) Each object in this array represents a Microsoft Dynamics 365 entity related to the indexed entity. **Example:** ```json "relations": [ { "name": "customeraccount", "fields": [ "name", "modifiedon", "websiteurl" ], "fromField": "customerid", "toField": "accountid", "toObject": "account" } ] ``` #### `name` (string) A string identifying the type of related entity. This doesn't need to match the Microsoft Dynamics 365 entity name, as it's only for identification purposes. **Example:** `customeraccount` #### `fields` (array of string) The names of the metadata fields to retrieve from the related entity. **Example:** ```json "fields": [ "name", "modifiedon", "websiteurl" ] ``` #### `fromField` (string) In the entity to retrieve, the foreign key identifying the related entity from which you want to index some metadata. **Example:** `customerid` #### `toField` (string) The primary key identifying the related entity from which you want to index some metadata. **Example:** `accountid` #### `toObject` (string) The type of entity to retrieve, as displayed in Microsoft Dynamics 365. **Example:** `account` ## "Queries to include" section reference Your FetchXML configuration should be formatted as follows. You can enter more than one query. If you do, queries will be executed in the order they appear in the configuration. ```xml active-cases Active Cases ``` ### `id` A unique string identifying your query. ### `name` A name identifying your query for troubleshooting purposes. ### `queryXml` The [FetchXML query](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-construct-query) to execute to retrieve the desired content. ## Reauthorize the source To authenticate and access your content, your source uses OAuth 2.0, a protocol that grants access to external applications without exposing the user's real credentials. OAuth 2.0 has access tokens that need to be updated manually when expired. . On the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page, click your source, and then click **More** > **Update access token** in the Action bar. . In the **Update access token** confirmation dialog: .. If this option is available, check the **Also update the token in the source identity security provider configuration** box. > **Note** > > Before you update the access token used by the source identity security provider, ensure that no source configurations will become invalid. .. Click **Update**. . On the page that appears, log in with the email address and password of the account that you created for the source to index your content. ## Required privileges You can assign privileges to allow access to specific tools in the [Coveo Administration Console](https://docs.coveo.com/en/183/). The following table indicates the privileges required to view or edit elements of the [**Sources**](https://platform.cloud.coveo.com/admin/#/orgid/content/sources/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/content/sources/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/content/sources/)) page and associated panels. See [Manage privileges](https://docs.coveo.com/en/3151/) and [Privilege reference](https://docs.coveo.com/en/1707/) for more information. > **Note** > > The **Edit all** privilege isn't required to create sources. > When granting privileges for the [Sources](https://docs.coveo.com/en/1707#sources-domain) domain, you can grant a group or API key the **View all** or [**Custom**](https://docs.coveo.com/en/3151#custom-access-level) access level, instead of **Edit all**, and then select the **Can Create** checkbox to allow users to create sources. > See [Can Create ability dependence](https://docs.coveo.com/en/3151#can-create-ability-dependence) for more information. ## What's next? * [Schedule source updates](https://docs.coveo.com/en/1933/). [Schedule source updates](https://docs.coveo.com/en/1933/).