Dynamics 365, Exchange & Logic Apps - Web enquiries match made in heaven

Most businesses 'Contact Us/Enquiry' pages generate an email notifying the business stakeholders of the submission along with the details of the enquiry. In a business where the sales or qualification process is managed in Dynamics, there is typically a need to integrate or automate the enquiry feeding into Dynamics.

There are various solution and architecture options available and I have been exploring using Microsoft cloud based offerings - Azure Logic apps, Exchange and Dynamics 365/CRM.

My objectives of the solution were:

  • No significant additional overhead added to Dynamics platform.
  • No custom coding.
  • Preference of configuration over customization.
  • Reusable with different or multiple website/portal solutions.

Here is a snapshot of the Azure Logic App I built achieving this.

My solution design and reasoning was:

  • On submission, the web form would send an email with an XML attachment to a specified address for processing.
    Most CMS/web portal platforms have out of the box capabilities to send an email with an XML attachment. Whilst we could integrate the form submissions to an Azure queue, direct into Dynamics etc, this would require custom coding.
  1. An Azure Logic App periodically checks a specified mailbox (Exchange online mailbox) for any new emails in the specified address above.
    Note how you can configure the conditions in which to process the email. Also, this is all still happening outside of Dynamics environment. alt
  2. If the email has an XML attachment, it validates the XML against a schema. For custom web applications, the scenario could be that we would provide the XSD for the XML format whilst we would create specific validation schemas for the other various CMS/Web Portal platforms e.g. drupal, Avoka and so forth.


You can store the XSD (used for XML validation) files in an Azure 'Integration Account', which you then link in and associate to the Logic App. Multiple schemas can be stored in a single integration account.

  • If the XML is valid , we would then map the XML values into Dynamics. (Using XPath to attain the values from the XML file to map to the Dynamics entity fields)


Resulting record in Dynamics:


In the solution above, as it was for exploratory purposes, I haven't done any validation checks in Dynamics for existing records but the various business processes and requirements can be added easily enough through logic apps.

The email processing and Logic App rules are all being done and managed outside of Dynamics. This means we don't have to configure a mailbox queue inside Dynamics to deal with the incoming messages - saving on overhead resources (async processing and storage space - all those XML email attachments!)

Other enhancements that could be added in our Logic App before it becomes a production solution would be to have a process to manage invalid XML attachments - this could be an email, SMS, case etc that is created when this occurs. Also, perhaps once the record is successfully created in Dynamics, the email could be moved to a 'Processed' folder - allowing us to easily identify those emails which have or haven't been actioned completely.

The solution is very light touch and doesn't require much user input or monitoring. The job runs are visible , both the successful and the failed ones - you can also re-run the failed jobs.

You can also see whether the process was triggered or skipped:

What I really like about the above solution is that it is all very configurable. You can change how frequent you check the mailbox, field mappings etc all from an intuitive interface without any coding! The only gap or concern I have with the above solution is if the initial email 'bounces' or just never delivers to the target mailbox. I will investigate the various contingencies to cater for this but for a solution that took less than an hour to build, it is pretty robust and works well. I hope this gives you some insights and ideas into the alternative capabilities available with the different Microsoft cloud offerings. Let me know if you have any thoughts on the above in the comments below.