Categories
Dynamics 365 Microsoft Forms

Lead generation with webforms part 3/3: Connecting with Dynamics 365

Task: Create a lead in Microsoft Dynamics 365 Sales from a web form submission
Difficulty: Easy
Total time to implement: 1-2 hours

Content

  1. Creating the form (read post)
  2. Embedding the form on a webpage (read post)
  3. Connecting the form with Dynamics 365
    1. Creating a flow
    2. Configuring the flow
    3. Testing the flow

In this last part of my three-part blog series, I’ll show how you can leverage a Microsoft Power Automate flow to automate the task of creating a lead record from a form submission. While in previous posts we have already created a web form, published it and embedded on a webpage, in this post we will create a flow that will create a lead record in Dynamics 365 Sales and send a couple of emails.

Creating a flow

Microsoft Power Automate offers many connectors that provide variety of ways to integrate different applications. For the purpose of our flow we will use Microsoft Forms submission as a trigger and the CDS connector. The great thing about the CDS connector is that it also works with both custom Power Apps and 1st party Dynamics 365 Customer Engagement apps.

We create our flow by going to the flow.microsoft.com website and:

  1. Click + Create on the left navigation. This opens a page where we can choose from different options. We will create a flow from blank.
  2. Choose Automated flow. This opens up a window where we can choose a trigger.
  3. Give your flow a name and select Microsoft Form submission as a trigger.
Create a flow

Configuring the flow

One of the things I like the most about Power Automate is its flow builder. For those who are like me and are used to Dynamics workflows, it takes some time to get used to the new maker experience. From the perspective of users that have no experience with workflows or flows, it is not so different from filling out a form. No worries, I will guide you through this. So, to begin configuring our workflow we first need to define which form applies and then a couple of actions which the submitted form (the trigger) will perform.

A) Get response details

  1. In the first block choose the form from the drop down list. In my case it is called ‘Get your free Lead Generation white paper’.
  2. Click on +New step button under the block to define the first action which the submitted response trigger will perform. You will see a variety of option in the list.
  3. In the search type in ‘Get response details’ and select the appropriate option from the list.
  4. In the Form Id field choose your form again and in the Response Id select the ‘List of response notifications’ from the Dynamic content on the right side.
The trigger and the get response details action

B) Create a new record

  1. Click on +New step button under the block to define the next action.
  2. Choose the ‘Create a new record’ from the list of actions or type its name into the search. (It’s a premium CDS connector. If you don’t have a license you can opt into a free trial.)
  3. In the new block that appears select the Dynamics 365 environment in which you want the record to be created. Note that the environment labeled ‘default’ generally does not have any app specific entities such as leads.
  4. In the Entity Name field type in ‘leads’ and select the Leads entity from the list. This will expand the block to include editable fields on the lead record.
  5. Fill in the fields using the Dynamic content options where applicable and give the lead a good name. I recommend you define the lead source value as well.
Create a new record action

C) Send an auto response

  1. Click on +New step button under the previously created block to define the third action.
  2. In the Search type in ‘Send an email’ and select the Send an email (V2) from Outlook.
  3. In the To field use the Dynamic content and select the Email either from the lead record created in B). This will automatically populate the email that the prospect provided when submitting the form.
  4. Type in a subject. You can personalize the subject line with Dynamic content. In this case I am just using plain text.
  5. Fill in your message in the Body field. You can use some basic formatting here, include hyperlinks and dynamic content. In this example I have used the first name of the lead and inserted a hyperlink to a PDF document on OneDrive.
Send an automatic response to the prospect

D) Send an email notification (advanced)

This part is a bit more advanced. So, if you are not comfortable with HTML you may want to skip this part and go to the next section.

A common requirement from marketing or sales teams is to receive an email notification when a lead is created. This can be achieved with the same action as in C). You can follow the same steps but type in a group email address belonging to your team(s) in the To field (e.g. info@example.com). What we want to do differently in this case is to leverage the id of the lead record to create a link to that record in Dynamics 365 Sales. To do this you:

  1. Open up any lead record in your CRM and copy the URL from the browser. You are going to need this in the next step.
  2. Copy the whole URL and paste it inside the body of the email.
  3. Delete the part that comes after ‘lead&id=’ in the URL. This is the unique ID of the lead.
  4. Replace the part you removed in point 3 with the lead id from the lead created in section B) . You’ll find this value in the Dynamic content.
  5. Copy the whole line from points 3-4 to your clipboard.
  6. Create a hyperlink using the create hyperlink icon.
  7. Paste the URL into the URL.
  8. You can remove what you typed initially typed in steps 3-4.
  9. Save your flow.
Send an email with link to the lead in CRM

Testing the flow

Microsoft Power Automate comes with a sophisticated testing mechanism. We want to test if our flow runs successfully before we deploy it. To do this we:

  1. Click the Test button on the top right side of our flow builder.
  2. From the two options that appear, select ‘I’ll perform the trigger action’.
  3. Click ‘Save & Test’. This means we have to perform the trigger action, i.e. submit a response through our form.
  4. Go to the landing page with your webform and submit a response.
  5. Go back to Power Automate flow builder to see the results. In this example the flow ran successfully.

Below are screens from the email notifications that were sent out as well as the lead that was created in Dynamics 365 Sales.

You can also watch how this is done by checking out the video below:

By Illugi Hjaltalín

Consultant and blogger. Always on the look out for smarter ways to perform work related tasks leveraging digital technologies.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s