Using Power Automate to Integrate Microsoft Forms with Dynamics 365

   Words by CRM Consultancy

   on 16/12/2020 12:26:00

Article by Jessica Corbett, CRMCS Dynamics 365 Consultant Jess' Article Imagery for Linked-in and Website

PowerApps provides the framework to integrate data seamlessly across different Microsoft apps in real time, rather than having to export and import data, or copy data across manually. One effective application that I worked on was using automated Flow (Power Automate) to integrate Forms with Dynamics.

We have a form where people can submit their contact details if they wish to be kept up to date with our monthly CRMCS Webinars. The aim of this job was to run a flow on the form submission, to check our database for a duplicate contacts, and if one existed then to update that contact, and if none existed then to create a new contact.

In this article I’m going to explain all the flow steps I used to get to this goal!

STEP 1 - Get the details from the form submission

We want to trigger this Flow every time this particular Microsoft Form is submitted. To do this, we’ll be:

- Creating a new flow starting with ‘Automated – from blank’.
- Then name the Flow, and select the first trigger as ‘When a new response is submitted’ in the Microsoft Forms triggers.
- When you’ve selected the form, select the data from the submitted form into your Flow.
- To do this, click add new step, and find ‘Get response details’ in the Microsoft Forms section.
- You can now fill in the ‘Form Id’ with the same form as in the first step, and then find the ‘Response Id’ from the dynamic content window from your first step.

image

STEP 2 - Initialise the variable

Next we want to ‘Initialise a variable’. This variable will essentially be a placeholder that we can increment as we search the database for duplicates, and will then dictate whether we need to create a new contact or not afterwards.

Find ‘initialise a variable’ under the actions area in the flow step, give the variable a name, and then set this to 0.

image



STEP 3 - Search the database for duplicate contacts

Now we need to search the database for any duplicate contacts, using the ‘List records’ action under the Common Data Service (current environment)’ actions.

Select the entity, then use the ODATA filter query field to specify what exactly you want to search on. (I only want to search based on the same email address, so I’m going to use the database field name and bring in the dynamic data from the form to make the following query: “emailaddress1 eq ‘[Email Address]’)

image



STEP 4 -
Update any duplicate contacts

We now want to add 1 to our variable for any contact that the search finds, then also update that contact record to update a Boolean field for ‘Webinar updates’ to ‘Yes’.

To do this, we need to:

Use the ‘Apply to each’ step control – this allows us to perform an action for each record the filtered query finds (if it finds any).

Select this step, then find the dynamic content ‘Value’ from your ‘List records’ step, and then define your actions. (I’m going to have two actions, one ‘Increment Variable’ – adds 1 to my pre-defined variable, and another ‘Update a record’ under the Common Data Service (current environment) to update the found contact record).

image



N.B the important thing to remember when updating a contact record is to set the Item ID to the ‘Current item’ from the ‘Apply to Each’ flow step. 

STEP 5 - If no duplicate is found, create a new contact

This flow will now run through the database and update any existing contact.

The last step is where we’ll create a new record, if no duplicate value is found. For this, we can use a condition step, to interrogate the variable.

If the flow has not found any duplicates, then the variable I set should still be equal to 0. Therefore I’m going to set a condition to say if the variable is greater than 0, then nothing should happen, and if it is not, then add a new action step ‘Create a record’ from the Common Data Service (current environment).

From here, I chose ‘Contacts’ as the entity, and then mapped every form field to the relevant field in our contact entity, using the dynamic content panel, and setting any static fields as required.

image




N.B. If you have a dropdown field in your entity that you want to fill in from the form, you need to ensure that all options from the form match to options in the entity, and you must click ‘Enter Custom Value’ when selecting that field to populate with the dynamic value

image





CRMCS main logo OUTLINES TRANSPARENT (1)

We hope you found this technical article useful, visit our Website for more Technical Articles including Microsoft Teams, PowerApps Portals, Dynamics 365 Marketing and more…

CRMCS RELATED ARTICLES : Flow – Getting Stuck in for Dynamics 365 https://www.crmcs.co.uk/content/building-and-testing-a-flow-for-dynamics.aspx

Share this Article

Search Articles

Filter Articles

CRM Tech DocMan

Recent Articles

Dynamics for Sales: Use Word Templates to Export directly to PDF Newly Generated Documents in Dynamics or Power Apps do not save into SharePoint Synchronising Dynamics / Power Apps Security with SharePoint Adding the DocDrive Bot to each new Microsoft Team Microsoft Team for each Key Account using Conditional Rules in DocDrive365 Styling Azure B2C for Power Apps Portals Azure B2C–the Subscription is not Registered Azure B2C and Power Apps Portals – User Flow for Signup and Signin Creating a New Azure AD B2C Tenant New Application Registration in Azure B2C for our Power Apps Portal Using Power Automate to Integrate Microsoft Forms with Dynamics 365 CRMCS Quick Start Guide: How To Produce a Microsoft Teams Live Event Dynamics 365 Marketing: Lead Scoring and Sales Acceptance Designing and Developing Microsoft Power Apps Portals Thank You for Attending CRMCS’ Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Thank You for Attending Our Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Webinar: Discover How CRMCS Have United Dynamics 365, SharePoint and Microsoft Teams To Create Sales Excellence Ignite your workflow by adding DocDrive365 to Office 365 The CRMCS guide to everything you need to know about integrating Teams with Dynamics 365 Saving Time By Keeping Documents In One Place TDE Database Encryption with On Premise Dynamics The Key to Successful Compliance in 2020 Part 2: Let’s get GDPR Compliant with Microsoft Power Automate
Contact Us

Want expert advice or a demo?

Get in touch now and see how we can help your business grow.

  • Name
  • Email Address
  • Phone Number
 
Close

Understanding Your Challenges

Our strong understanding of CRM and emerging technologies within the Microsoft environment means we deliver the right solutions for you.

Proven Real-World Solutions

As a leader in the field of Dynamics solutions, our pedigree developing and delivering real-world solutions is unsurpassed.

Long Term Support

We provide support beyond our design, implementation and 'go-live' delivery using Sprints and continual updates to our AppSource apps.

CRMCS | Design by Thinktank Marketing | Citrus-Lime Limited

To improve your experience today and in the future, this site uses cookies. Read our full Privacy Policy & Cookie information here I Understand