As we’ve looked at CDS in these previous articles Creating your first Common Data Service (CDS) database and How to import .csv data into CDS, let’s bring it back home and see one way to bring data from your Dynamics 365 Customer Engagement into CDS. We’re looking at Flow now.
We can use Flow for both importing and exporting data with CDS. In addition, we can use it for both standard and custom entities. As for sources, the list of connectors is continuously growing. What does that mean? We can actually synchronize data between various application using CDS.
Note that, while we’re doing this, we’re following a typical scheduled ETL flow. This is not a synchronization service. One of the biggest differences is the fact that no deletes are supported. We can create records, update records, but have no ability to capture delete.
To make things even easier, various templates exist for this process. If one does not exist, you can create a custom flow that uses the database.
Let’s focus our attention now on getting Dynamics 365 data into CDS. For this, we’re looking at the most basic scenario of moving data on a per-entity basis.
Start from your Flow portal and sign-in. Choose an environment to work in.
As a first step, it’s good practice to look at the existing templates and see if one is already available. If one is not, then create one from scratch.
To find existing templates, go to flow.microsoft.com and search for dynamics. You’ll find a long list of results. Select the one to copy Accounts to CDS, and select Use this template if you intend to use an existing template.
You’re prompted to login with your Office 365 account. That takes you to the flow details as part of your instance.
Alternately, you can start from scratch and create your own flow. To see how hat works, let’s go ahead and create our own simplistic flow that created a CDS Account record when a new Account is added in D365.
Select Flows on the left navigation, then select Create from blank on the top. This takes you to the wizard. Remove the default PowerApps step, and then create a new step.
In the search box type Dynamics 365, and select it from the connectors. You can just select the trigger directly. In our case, we’re looking for a trigger of “When a record is created”.
Select the Preview trigger as it includes option set selected values as strings. Once you select the organization and Accounts for entity, create a new step. Select Add an action.
In the connectors search, type Common. This brings up the Common Data Service connector, as well as the Actions. Since we’re about to add a new record into CDS, select the “Create a new record” option.
On the configuration screen, select the database (default if you don’t have a named one created), and the Account entity.
Once you select Account, the wizard prompts you to map your data fields. The mandatory fields are brought to the top of the mapping. Make sure you map all needed fields here, then name your flow and click Create Flow.
Once complete, your newly created flow will show up in the list of My flown.
If you click on the flow name, you can drill down and edit the description, as well as see the Run History. Here you can see the executions and the completion state. Clicking on a specific run allows you to drill down even further and see what each step did, as well as trace where error occurred in your flow.
In a very simplistic manner, this is an easy way to extract data from an existing system and move it to CDS. Go ahead and play with it, increase complexity and see how much you can automate.