In my last post on “Making sense of Common Data Model and Microsoft PowerApps in Dynamics 365“, i explained in detail how you can use the Microsoft Common Data Model and PowerApps to create powerful business apps for your organization.
Along with the Common Data Model and Microsoft PowerApps, another significant component of Dynamics 365 is the new cloud based event automation service from Microsoft called as “Microsoft Flow”. Microsoft flow is basically an task/process/event automation service, that allows to execute certain event (Such as sending an email notification, Creating a new record, saving/sharing files and more) when another event happens (Such as a new record is added to Common data model, a record is modified, a new person follows you on twitter and more).
You can learn more about Microsoft Flow Here.
In today’s post, we will see how you can take advantage of Microsoft Flow and automate several events between Common Data Model and other components of Dynamics 365 which are Dynamics CRM, Dynamics AX ERP, Project Madeira and others. In the current release of Microsoft Flow, only Dynamics CRM online is available for event automation, but when Dynamics 365 releases in future, you will start seeing other components such as Dynamics AX, Project Madeira and more.
In this walk through, i would have liked more to show how we can automate the process of “Creating a new Opportunity record in Dynamics CRM online, when a new opportunity record is added into the Common data model”. But I am having an intermittent issue connecting my CRM sandbox environment to Microsoft Flow. So, i will alter the flow a little bit and will send an email notification instead to myself, when a new opportunity record is added in the common data model.
With that said, let us go ahead and create this flow. Follow the steps below.
- Login tot Microsoft Flow using your Office 365 credentials at the below URL. https://flow.microsoft.com/en-us/.
- At this point, you can create your flow from a template or create it from blank. I will create the flow from blank.
- The next step is to set the initial trigger which will kick off the event (Which in this case is sending an email notification). So i will select the trigger “Common Data Model – Object is created”. Notice that you have several triggers from Microsoft applications and services, as well as for several 3rd party apps. This list of triggers ois going to grow over the period of time adding more capabilities.
- Now I need to select my database name in the common data model. I have already configured my database in common data model and will consume the same in this walk through. After selecting the database, i will also need to select the Entity name, which is “Opportunity” in this case, since i want to create my flow using this.
- We will now setup the Next step by clicking the New Step button. Notice that you will see various options here such as “Add an action”, “Add a condition”, “Add a loop” and more. In this case, i will select Add an action.
- My preferred action if my CRM Sandbox environment did not have the issue would have been to add the new opportunity record in it. You can see in screenshot below that i have highlighted the action.
Since my CRM environment has the intermittent issue and i cannot connect it to my flow, i will use another action, which is to send an email notification to myself informing that a new opportunity record is added to the CDM.
- The next step is to specify the email ID, subject and the body of the email notification. Screenshot below shows how you can set these up. Notice that you can make the email notification more detailed by adding the data fields in real time from the Opportunity entity into the email notification. For this walk through i will just use the basic one. You can even click the Advanced options to make the email notification more sophisticated with attachments, Cc, Bcc etc.
- At this point, you can add as many steps/conditions/actions/loops as you want based on your flow’s requirement. In this case since the flow i wanted to created, i will provide a title for the flow and click Create flow and then click Done.
- That is it! Our flow is now ready and we will now go see this in effect. To do this, we will open the Common Data Model and add a new Opportunity record in the Opportunity master. There are multiple ways of inserting the data into CDM, I will do this by connecting to my CDM database and opening the Opportunity entity in Excel and publish the new record from Excel back to the CDM.
- As soon as I click Publish and the record gets created in CDM, I got the email notification as per the setup we did in the flow. If I had my desired action setup, then it would have created a new opportunity record in Dynamics CRM online.
This blog post was intended just to give you an idea of what is possible using the Common Data Model, Microsoft Flow and other components of Dynamics 365. When Microsoft Flow evolves with time and Dynamics 365 launches with more features, you can create various purpose built flows to automate tasks and processes of your organization in the ERP in real time. Stay tuned for more features, and discussions. Till next time !!!!