Using Power Automate to Integrate Microsoft Forms with Dynamics 365

   Words by CRM Consultancy

   on 16/12/2020 16:28: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 or a boolean (yes/no) field in your entity that you want to fill in from the form, you need to add this in a particular way. We’ve published another article detailing exactly how to do this here: Using Multi-Select Option Sets in Flow with Microsoft Forms





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

Release Wave 2 New Feature: The Columns Button HOW TO: Search a date field in Microsoft Dynamics The Relevance Search COMING SOON to Power Apps Portals HOW TO: Manage Your Dynamics 365 Database Size (Video Included) Dynamics 365 Marketing vs ClickDimensions It’s time to pause, reflect and acknowledge a new era of inclusivity and collaboration. Part 2 - How to get the most from a Technology Expert – Asset Management Hub Property & Asset Management Hub Part 1 – Balancing CRM and Asset Management Scopes - Asset Management Hub Creating a Multi-Lingual PowerApps Portal How to Set Up a Microsoft Teams Site Using DocDrive365 Microsoft Teams - Adding a Microsoft Teams URL to a Dynamics Appointment Dynamics 365 Marketing – Customer Voice Survey Not Appearing In Emails? Using SQL Management Studio to connect to the Dynamics DB Calling a Power Platform AI Builder Model via oData How to use DocDrive365 to integrate permissions between Business Units in Dynamics with Sites in SharePoint Getting started with the Power Platform AI Builder. Power Apps Portal Information Hub DocDrive365 Security: Day One - Getting Started with Dynamics to SharePoint Permissions Part 5 - Power Apps Portals: How To Connect Azure B2C With Linked-In Part 4 – Power Apps Portals: Styling Azure B2C for Power Apps Portals The 3 Phases for Using Multi-Select Option Sets in Flow with Microsoft Forms Part 3 – PowerApps Portals: Azure B2C and Power Apps Portals – User Flow for Signup and Signin Part 2 - Power Apps Portals: New Application Registration in Azure B2C for our Power Apps Portal Part 1 – Power Apps Portals: Creating a New Azure AD B2C Tenant
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