Customising microsoft form submit button to do a specific action

Copper Contributor

Hi people, 

 

Very new to Microsoft Forms so please bear with me. Is there any technology I can use to make a Microsoft Form submit button to do something specific? The form will have a number of categories people click on (e.g. option 1, option 2 etc). When they submit, I would like put in a mechanism in place so that the responses get submitted to an email address with the subject line starting with "option 1..." or "option 2..." depending on what the user has selected. Is that even possible? 

 

Any help would be much appreciated.... many thanks in advance :)

2 Replies

@OzzyDinc you can't do this with Forms on its own and you can't program the Submit button to do anything. But you can achieve what you want with a flow in Power Automate that will trigger when the form is submitted and will route the email to a specific person depending on the question option selected.

 

If you are not familiar with Power Automate there are many good videos on YouTube to get you started and I particularly like those by Shane Young which got me started with Power Automate and Power Apps 5 years ago.

 

So in this example we have a workshop feedback form where in one of the questions the user will select the engineer who performed the service and the email will be routed to that engineer.

 

Form

 

0-Form.png

 

 

Flow

Do NOT use the Forms template in Power Automate as it has an error that Microsoft have never corrected. Create your instant flow from blank.

 

1. A flow can only have 1 trigger and in this case it is the Forms trigger "when a new response is submitted". You select your form from the dropdown in the trigger.  The trigger is immediately followed by the Forms action "get response details" and again you select your form then click in the Response Id field to open the dynamic content box and select Response Id.

 

1-Flow.png

 

2. Then add 2 string variables with the initialize variable action. The first one will be to hold the email address to send the email to. Give it a name like varEmail, select string as the type and leave the value field empty, we'll populate this later. For the second one I've named it varEngineer, selected string and in the Value field, from the dynamic content box I've selected the question about which engineer performed the service.

 

2-Flow.png

 

3. You might not need this next action, but I wanted to make sure the date of the service in the email is in UK date format so I added a Compose action, clicked in the inputs field then in the dynamic content box I clicked the Expression tab and typed formatDateTime( selected the question with the service date, then, 'dd/MM/yyyy')

 

3-Flow.png

 

4. We need to populate the value of the email variable with the email address of the engineer, so we do this with a Switch action which is is a type of condition that looks at just one thing, in this case the engineer. A switch has several cases: "Case engineer equals Miguel". You can have up to 25 cases for each switch. Inside each case I've added a Set variable action, selected the varEmail variable and entered the email address of that engineer.

 

4-Flow.png

 

5. Finally we add a Send an email (v2) and with this action the email will always be sent from you as the creator of the flow. At my company we usually use the send an email from a shared mailbox (v2) which will of course send it from the shared mailbox providing you have send permissions on that mailbox. And you can populate the To, Subject and Body of the email with dynamic content as you see below.

 

5-Flow.png

 

6. And this is the personalised email that is sent to the engineer with the relevant dynamic content.

 

6-Email.png

 

At my company we do this Forms to Email flow a lot, although invariably with an intermediate action of creating an item in a SharePoint list. And we add things like the company logo and other slightly more advanced actions.

 

I hope this gives you something to think about and explore.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

Wow @Rob_Elliott, this is most educational, you are amazing. Definitely things to think about and explore.  Thank you so much!!

 

Ozzy