Synchronizing New CRM Accounts to AX Using Flow and the Common Data Model
There has been a lot of talk about the Common Data Model, Power Apps and Flow recently and how it could be used. One of the ways that we have found the most useful is with the synchronization of data between CRM and AX. Usually this would be a painful process of creating web services on both sides of the applications and then trying to tether them together with some additional code.
Flow and the Common Data Model are another option, and in just a couple of minutes you can easily build a synchronization service that does just that. In this walkthrough we will show you how you can do just that.
Creating A Synchronization Flow From CRM To The CDM
The first thing that we will need to do is to synchronize the CRM Account records with the Common Data Model so that every time a new record is created then it is copied up to the Common Data Model database.
How to do it…
Luckily this is not a hard task because flow comes pre-packaged with templates that do just that. All you need to do is search the templates for the Copy new Dynamics CRM Accounts to Common Data Model customer organizations template and click on it.
When the template information is shown, all we need to do is click on the Use this template button.
Flow will check that we have connections to the Common Data Model and also to CRM and then we can click on the Continue button.
This will create a simple Flow for us and we just need to configure a few things.
Start off by selecting the CRM Organization Name from the dropdown list.
And then select the CDM Namespace from the dropdown list.
After we have done that we can just click on the Create flow button to create the flow.
There are a number of these templates available that will synchronize the Cases, Contacts, and Leads with the Common Data Model, and if you want extra credit then it’s easy to add those to our Flow library.
Creating A Synchronization Flow From the CDM To AX
Now we have created the flow that will synchronize CRM to the CDM we can create the other side of the process which will create a new Customer Account within Dynamics AX whenever a new Customer record is created within the CDM database entity.
How to do it…
To do this we just create a new flow with a trigger of when the Customer entity within the Common Data Model is updated.
And then add an action that creates a new record within Dynamics AX, and passes through the Customer ID and the Full Name from the CRM Account Record.
Seeing The Synchronization In Action
Now that we have out two trigger events we can take a look at the whole process in action.
How it works…
All we need to do is create a new Account record within CRM and save the record.
This will trigger the flow that moves the record from CRM over to the Common Data Model.
If we drill into the flow execution then we will see that it both tracked that the customer was created and then it created a record.
If we expand out the trigger event then we will see all of the CRM data that was passed through into the Flow.
And then we will be able to see all of the fields that were automatically passed over to the Common Data Model entity record.
If we look at the second Flow that is moving the data from the Common Data Model to AX then we will also see that the flow triggered for that as well.
Drilling in we will see that the event was triggered based off the Common Data Model Entity being updated and then an action was performed to create a new Customer record within Dynamics AX.
Looking at the trigger event we can see the data that was added within the Common Data Model entity record.
And also we can see the new record details that we created within Dynamics AX.
If we look in Dynamics AX then we will see that a new record was created and it was assigned the same Customer number as the record within CRM.
I don’t know about you, but I think that is pretty darn cool, and super easy to set up.
About the Author
Murray Fife is a Technical Solution Professional at Microsoft and an Author of over 25 books on Microsoft Dynamics AX including the Bare Bones Configuration Guide series of over 15 books which step the user through the setup of initial Dynamics AX instance, then through the Financial modules and then through the configuration of the more specialized modules like production, service management, and project accounting. You can find all of his books on Amazon at http://www.amazon.com/author/murrayfife.
Murray is also the curator of the Dynamics AX Companions (www.dynamicsaxcompanions.com) site which he built from the ground up as a resource for all of the Dynamics AX community where you can find walkthroughs and blueprints that he created since first being introduced to the Dynamics AX product.
Throughout his 25+ years of experience in the software industry he has worked in many different roles during his career, including as a developer, an implementation consultant, a trainer and a demo guy within the partner channel which gives him a great understanding of the requirements for both customers and partner’s perspective.
For more information on Murray, here is his contact information: