Integrating Dynamics 365 ERP and CRM – Using Microsoft Flow and Common Data Service

This blog was written a while back! If you’re trying to integrate Dynamics 365 ERP and CRM, please refer the following document:

Dynamics 365 unifies CRM and ERP capabilities into applications that work seamlessly together across different areas of a business. Two main components of Dynamics 365 are CRM and ERP applications.

For customers who use both CRM and ERP applications (for example, Dynamics 365 for Sales and Dynamics 365 for operations), it is important that these applications integrate and work together and one option for customers/partners is to use Microsoft Flow and Common data service (CDS)

 Why can’t we just sync data between CRM and ERP using Microsoft Flow only? why do we need to use Common Data Service?

In most cases, mapping of data between these products cannot be done directly. Same data may be stored in different ways or formats in these applications.

A simple example is, how Currency is used: In Dynamics 365 for Sales, Customer’s currency is stored with currency name as US Dollar whereas, in Dynamics 365 for operations, same data is stored with currency code as USD. In such cases, we can have a staging database in CDS to map as required in the destination application.

In this blog, I’d like to show an example of using CDS and Flow to sync/copy Accounts data from Dynamics 365 for Sales to Dynamics 365 for Operations.

Creating an entity in CDS to map currency between CRM and ERP:

Create a simple, new entity in CDS called Currency Mapping with 2 main fields:

1. Currency CRM (Type: Text, PrimaryID, Unique and Required)

2. Currency AX (Type: Text, Required)

Save the currency mapping data in this entity as shown below. You can use the Open in Excel to enter the data into this entity and import the excel using Import Data option.

With this, staging data for this demo is set.

Create a Flow to copy the data from Dynamics 365 for Sales to Operations:

We’ll create a Microsoft Flow which uses Currency Mapping entity created in CDS along with the source and destination applications.

1. The Microsoft Flow will be triggered when an Account record is updated in Dynamics 365 for Sales. (It’s better to have certain relevant flow condition(s) after this step to make sure every update to account record is not triggering this flow)

2. In Dynamics 365 for Sales, the customer’s Currency name is available from an entity called Currencies. Hence, the next action is to identify the record which has the customer’s currency in Currencies entity:

3. Depending on the currency name we have from the previous step of Flow,  we’ll find the mapping currency in CDS. Hence, the next action is to get the right record from CDS with the key value being Currency Name.

4. The last action is to create a record in Dynamics 365 for Operations. (instead of directly creating a record, we can check if the record already exists and update it as well)

With this, we have a Flow with 4 steps, which creates a customer record in Dynamics 365 for Operations when an Account is updated in Dynamics 365 for Sales.

Similarly, we can use Flow and CDS to sync data with Dynamics 365 for Financials or Dynamics NAV too.

Please note: The intention of this blog is to highlight the usage and CDS when integrating 2 applications. you may have to create more entities in CDS and more steps in Flow for a tight integration.

You may find the below articles helpful:

The Common Data Model and its role on Dynamics 365:

Microsoft Flow and Dynamics 365: