If you wish to send data from Sitecore Forms directly to Dynamics, then you might consider using the Sitecore Connect™ for Microsoft Dynamics 365 for Sales module. This article highlights some of the key stages that you need to consider when using this approach.
Consider and retrieve the data
When sending data to Dynamics, you need to first of all consider how that data needs to be stored within the platform. Fields like OptionSet need to be stored as integer values, that relate to a specific option. Whereas with Entity References you need to send the correct identifier for the entity you wish to refer too.
In order to send data in the correct format, you need to first of all retrieve the data from Dynamics. The following article Retrieve Dynamics Optionset and Entity Reference data for use in Sitecore Forms goes into detail about how you might approach this.
Building your Sitecore Form
You can use the OTB tools to create the majority of the fields you wish to capture and send to Dynamics. When it comes to the more complex data types, like Optionsets and Entity References, you might consider creating some custom dropdowns, in order to fashion the data into a format that easily allows users to select a value.
The following article Build a Custom Dropdown List to display data from Dynamics goes into a lot more detail on how you might achieve that.
Send the Data to xDB
Rather than sending the data directly to Dynamics (which is an option), you could first of all store the data in XConnect. By doing so it directly links the form submission to the xDB contact, so that you can use the data (or subsequent data sent back from Dynamics) to personalise or send messages. It also then gives you access to previous form submissions.
NB: I also liked this approach, as it breaks the problem down into stages. Get the data to xDB first then worry about Syncing to Dynamics after.
In order to send the data to xDB, you need to first of all create a custom model and facet to store the form submissions, then create a custom submit action to push the data to XCOnnect. This article goes into a lot more detail about this process: Submit Data to xDB (before sending to Dynamics)
Sync Data From XConnect to Dynamics
In order to send data to Microsoft Dynamics, you can use the Sitecore Connect for Dynamics Connector (which sits on top of the Data Exchange Framework). When installed, you are provided with a number of OTB pipelines, one of which syncs Contacts from XConnect to Dynamics.
This pipeline only syncs the OTB Sitecore Facets, like Personal Details, Emails, Addresses etc. To meet our requirements, you need to customise that pipeline to map any additional fields from our new model to the Contact model. Then map any 'Leads' (form submissions) from our custom facet, to new Inbound Interest entities, linked to the Contact entity. This article goes into more detail on how you might approach this: Sync Data From Sitecore To Dynamics.
Issues and Gotchas
We experienced a number of issues along the way, some of which related to the mapping of contacts from Dynamics to XConnect. This was mainly due to the way both platforms store contacts and the identifiers they use. The following article looks at some of the issues we faced when syncing between the two platforms: Issues syncing contacts from Dynamics To XConnect
