Mapping Microsoft Forms Pro Survey Responses to a Dynamics 365 Record

Sean Roque, 05 May 2020

Microsoft Forms is a survey application to easily configure surveys with various question types. With Microsoft Forms Pro, there is improved capability for survey analysis and sharing. You can learn more about it here.

Despite its own survey analysis functionalities, it might still be beneficial for businesses to integrate it with an existing CRM such as Dynamics 365. Thankfully, with the aid of Microsoft Power Automate Flow, mapping Forms Pro survey responses to Dynamics 365 can be implemented.

We can create a custom entity and track each survey question. For example, we have this custom entity “Assessment”, where we capture information about the person filling out the survey, the question and the response.


Mapping Survey Responses

You can learn more about sending Microsoft Forms Pro surveys, via Dynamics 365 in my next blog, but for now let’s assume that you’ve sent the survey and a recipient has submitted a response.

1. Create a Flow with an automatic trigger of “When a new response is submitted” for Microsoft Forms


2. Add the “Get response details” Microsoft Forms action

3. Select the appropriate form in the dropdown for both the trigger and the new action. In our case it is “Magnetism Solutions Sample Survey”image

4. Add the “List of response notifications Response ID” dynamic value from the trigger, to the “Get response details” action.

From here, most of the values that we need to retrieve from the survey response are quite neatly represented as dynamic values. For example, the answers to the survey questions appear like so, which can be easily referenced and mapped to the Assessment field.


5. If the recipients exist as Contacts in Dynamics 365, you can retrieve which contact this is associated with via a List records action, with the “Responders’ Email” value as the filter:


6. If the recipient is a Dynamics 365 Contact and you followed the previous step, add an “Apply to Each” action and have the selected output be the value of the List records step:

You can then refer to the Listed contact record and map that to the lookup in a CDS “Create a new record” action for Assessments.

Otherwise, skip that and just add a CDS “Create a new record” action, for the Assessment entity.

Now we want to map the survey responses, which are already dynamic values that we can refer to. However, a key thing to note is that all responses are passed to Power Automate as strings, no matter the question type setup in Forms Pro.

The following are the “Get response details” output. I have commented the Forms Pro question type in red:


"submitDate": "3/17/2020 9:49:22 PM",
"r0ac57a69436245f0b635a486ff62154f": "Full-Time", Option-set
"r4fe3411e421c47d9adb189bacd1a5be9": "5", Rating
"r1f14bf214d9749ed933351681530402a": "2020-02-04", Date/Time
"rd3674700d622459096bc56dc93d545d3": "Silver, Gold, Diamond”, Ranking
"r7af70caf62324a5c892af258ca516b18": "",
"r102aed5ad9b8438faae64d1703d1b2ac": "Strongly Agree", Rating
"re5b7a66a49d646baa35160923d2cf659": "Agree", Rating
"r56efd75f45be4789961f41e2a496dfd6": "10", Rating
"r1f75736e563f4d149f183f14f508481f": "",
"r5cb9535f72774606ba5e07e7a929d743": "",
"r0aa0753a3f4c4d6faee77cb45de4e125": "",
"rf423795b1f19492581386f32e75b19e6": "",
"r2e6007ca2ba0491e81f69a8a9041e883": "Friendly people", Free-text
"r3dd32becb7ce4aada6f082b18101f338": "Yes" Two-options


For Single line of text or Multiple lines of text fields, you can simply refer to the Dynamic value and it will map correctly.

The challenge however is to map these to various Dynamics 365 field types e.g. option-set, whole number, two-options, date/time , despite them being all initially being in text-form.

The solution is script in Flow to populate the Dynamics 365 field.

Whole Number

To populate a whole number field, simply add a Compose action and convert the number string returned by the Forms Pro survey response.


Date and Time

Seeing from the output above, we know how Date/Time values are represented in a string from the survey response, so we can write script to convert this.

Again, we can add Compose action and use the formatDateTime() function to convert the date string.

formatDateTime(body('Get_response_details')?['r1f14bf214d9749ed933351681530402a'], 'yyyy-MM-dd')

Option-sets and Two-options

Finally, we’ve got option-sets and two-options fields, which we can handle by checking for the input string and assigning the Dynamics 365 option value to populate the field via the Create record action.

For example, a yes/no question in Forms Pro can be tracked in a Two-options field in Dynamics 365.

if(startsWith (body('Get_response_details')?['r3dd32becb7ce4aada6f082b18101f338'], 'yes'), true, false)

Or option sets, by identifying an options specific value:

if(startsWith(body('Get_response_details')?['r0ac57a69436245f0b635a486ff62154f'], 'full-time'), 809730000, if(startsWith(body('Get_response_details')?['r0ac57a69436245f0b635a486ff62154f'], 'part-time'), 809730001, 809730002))

Microsoft Forms Pro is a useful tool for creating and sending surveys, while also offering advanced analytical functionality. Now we know we can easily map these responses to Dynamics 365 via Power Automate Flow. In my next blog, I will be talking about how we can send Forms Pro surveys within Dynamics 365.