Saturday 22 September 2018

Connecting Office 365 SharePoint with CDS using Microsoft Flow

How many of you have heard about CDM and CDS? These two components are availabe on Microsoft platform. CDM stands for Common Data Model and CDS is Common Data Service.

CDM is a secured database stored on Microsoft Azure, which contains business standard entities. Those entities can be used by users for various purposes including integrations. This is commonly used for integrating two Microsoft Systems, with the help of templates/entities.

CDS is a basically a service, that utilizes common data model to enable cross platform reporting capabilities. It is most commonly used on Power BIs for report generations.


Scenario

Think of a scenario, where some application uses common data service for storing the data. And some application uses Office 365 SharePoint as the storage point. And both of these applications deals with the same data sets. In this case, both of these storage system needs to be synchronized.

The solution which we are looking at may not be a full end to end solution, but let’s see how we can push data from SharePoint to CDS. There might be many ways, but here let’s look how it can be done easily using Microsoft Flow with just configurations.


Configuring Flow and CDS Environment


Microsoft Flow provides connectors, with multiple triggers and actions. Since the trigger is going to be Office 365 SharePoint, we will only be looking at actions from CDM.

If you haven’t created database, you can create the databases from admin center of Flow/PowerApps. In this case, I will be using preview entities option available. The entities can be accessed using power apps platform.



Create an entity and add necessary fields.



And the list is created at SharePoint with the name “books”. Now go to flow platform, and create a new flow from blank.
  • Create a trigger for the list item, which is “when an item is created”.
  • Add an action. In the action search for common data service connector and select create a new record action.
          Note: when prompted for connection details, provide the user credentials where common data              service is available. In this case, it is the same user.
  • Then in the action, select the organization name, entity (which we have created above), title of book, author and sharepoint id details. Here Primary name is sharepoint list item title, Author is created by user display name from SharePoint, sharepoint:id is SharePoint list item ID (To be inserted using output properties from the trigger). SharePoint ID should be converted to integer before storing on CDS.




Test the Flow


Go to Office 365 SharePoint list, and create a new item. Once flow successfully runs, go to entities to check the data created.



Now, the applications can be integrated using CDS in multiple ways. It can be PowerApps, Power BI, etc.