Microsoft Flow is a tool that can create automated processes across many applications such as Twitter, SharePoint, Outlook and Dynamics 365. It can help automate processes in ways not possible before in previous versions of CRM. All of this can be done without the use of a developer, which saves time and money. This article will focus on the steps to configure MS Flow to automate Lead creation in CRM from an external website. Previously, if you wanted a visitor filling out contact information on your website to automatically be created as a Lead in Dynamics, you would have to spend a lot of time on custom development. With Microsoft Flow, the process is much simpler and streamlined.

Navigate to Microsoft Flow

Go to and login with your organization credentials. Once in, click on the “Flow” tile:

O365 Dashboard

Create a New Flow

In the Flow website, click on “My flows”. Then, click on “Create from blank”:

Flow Dashboard

Choose a Trigger Action

Click in the search box that says “Search hundreds of connectors and triggers”. This will take you to a new page. Then type “http” in the search box. Click on “Request – When a HTTP request is received” trigger that comes up in the results:

Flow Step 1

Insert JSON Schema

You have now selected an HTTP trigger. This trigger will fire from the webpage you connect to Flow. You must insert a JSON schema into the trigger. The schema should contain the names of the fields on your webpage that you want to be pushed into Dynamics. Here is an example of what a JSON schema looks like:


“$schema”: “”,

“type”: “object”,

“properties”: {

“firstName”: {

“type”: “string”


“lastName”: {

“type”: “string”


“email”: {

“type”: “string”


“address”: {

“type”: “string”


“city”: {

“type”: “string”


“comments”: {

“type”: “string”


“company”: {

“type”: “string”


“phone”: {

“type”: “string”


“region”: {

“type”: “string”


“state”: {

“type”: “string”


“zip”: {

“type”: “string”


“referrer”: {

“type”: “string”



“required”: [












Once this has been inserted into the Request Body, click the New Step button:

JSON Schema

Add Create Lead Action

After you click the New Step button, you have the option to Add an action or Add a condition. Choose Add an action. In the search box that appears, type “dynamics”. Click “Dynamics 365 – Create a new record” in the results that appear:

Flow Step 2

Configure Record Creation

In the Create a new record action that appears, choose the proper Organization Name from the drop-down. Then choose the correct entity type of the record you wish to create. In this example, we will be creating a Lead record. Once these options are selected, the box will expand to show you all available fields to set for creation:

Configure Lead Creation

Fill in Required Fields

Fill in the required fields for the Lead. The field information brought over from the HTTP request should be available as Dynamic Content to insert into the fields. Any field identified in your JSON schema should be available as dynamic content:

Fill in Lead Fields

Save Flow and Generate HTTP POST URL

Once you have filled in all the fields desired in the Lead creation step, save the Flow using the save button in the upper right-hand corner of the screen.


Take note that once the Flow is saved, the HTTP POST URL has been automatically generated. This is extremely important as this URL connects your website to Flow:

Copy Post URL

Add POST URL to Your Website

On your website, put the auto-generated URL into a new XMLHttpRequest. An example of the function, plus a very simple and testable web form is below. This will show you how this can be done and where the URL could be put in:

First Name:

Last Name:











Run Code in Chrome to Test

If you have Notepad++, you can save and run the code from above in a browser. Be sure that you have pasted in your unique POST URL and then saved the code from above. The webpage that opens should look like this:

Simple Form

Fill in Fields and Click Submit Button

Fill in the fields and click the Submit button. Then, navigate back to Flow to see if the job ran:

Form Filled in

Verify if Test Was Successful

Go back to Microsoft Flow and verify that the test ran successfully. If you go back to “My Flows”, you should see a Run History:

Flow Verification

Navigate to Dynamics and Verify that Lead Was Created

Now if we navigate to our Dynamics 365 environment, we can see that the Lead was created successfully. All the fields that we wanted to be populated will have been filled in as we desired.

D365 Verification


Integrating webforms with Dynamics is significantly simplified with Microsoft Flow. The utility of Flow doesn’t stop here, either. You can set up email alerts when a new Lead is created. Or you can assign these new Leads to a user other than yourself. In the past, this process took custom development and was costly. But now, all you need is a little knowledge of JavaScript and you can easily set up webform CRM integration in a simple and cost-effective way.