Extract form field values in Power Automate flow

Send e-mail notification to an adaptive form submitter with Microsoft Power Automate by extracting field values from the form submission.

Transcript
In this video, we will take a look at the use case of triggering an e-mail notification from a Microsoft Power Automate workflow when an adaptive form is submitted. To demonstrate the use case, I have created a simple form, and I’ve configured this form to trigger an Microsoft Power Automate workflow. So if you go into the submission options here, it says invoke a Power Automate workflow, and the name of the Power Automate workflow is send e-mail on form submission. This form, as you can see, is not based on any schema. That means the data submitted from this form would be in an XML format. So now, if I were to preview this form here, and submit, it should trigger the Power Automate workflow, and the workflow should send an e-mail notification to the submitter’s e-mail. So I should get an e-mail notification momentarily in my inbox here. So if I were to open my e-mail inbox, here, that’s the e-mail that I got here. So it says, Dear Girish, thank you for your form submission. In the next video, we will take a look at how to create the Power Automate workflow, how to extract the data that was submitted from the form submission, and how to extract the specific field name values from the submitted data. In this video, we will take a look at the Power Automate workflow that was used to send an e-mail notification on an adaptive form submission. So I’ve logged into my Power Automate instance, and go to my flows, and this is the flow that we’re going to take a look at, because this was the flow that was used to send an e-mail. So click on Select the Flow, and click on Edit. Open up the various actions that were used in that particular workflow. The very first step, as you can see, has to be when an HTTP request is received. So whenever you want to trigger a Power Automate workflow on an adaptive form submission, make sure the very first step in your workflow is when an HTTP request is received. So that’s the entry point, and you need to provide the appropriate schema. So this schema will be given to you by AMForms. The reason for this schema is, the submitted data will adhere to this schema. So let’s take a look at this schema in a JSON editor here. So that’s the schema. So it has various objects. The object that we are interested in is called data, and it is of type string. So this data element of that schema will hold the submitted data from the adaptive form. In our case, our adaptive form was not based on any schema, hence, the data would be in an XML format. Go back to the workflow. So that’s the very first step here. Then the second step is to create a variable to hold the submitted data, and that variable is called submitted data. We have initialized submitted data. It is of type string, and we have initialized it to the data element of the HTTP request. So if you click on this here, you would see that when an HTTP request is received, you store the data that is in the data element of that particular schema. So that is what we’re doing here. So make sure you use the dynamic value, and that is the data here. So now, so far, we have initialized a variable called submitted data. It is of type string, and it will store the value or the string that is in the data element of the submitted data that we got from our adaptive form. The next thing is to convert this submitted data, which is of type string, into an XML. So for that, I’ve used a compose action here. So if you click on it, and I’ve used a function here to convert the submitted data into an XML. So these are all, again, standard out-of-the-box Power Automate functions to convert string into XML. So that is what it does. Once we have the string converted into XML, the next step is to extract appropriate element values from the XML. So for that, again, I have used a compose action here, and I’ve used a function which is quite large here, multiple functions. So I’ve used this XPath into the XML, and then from that XML, I’m extracting the first name element of that XML. In a similar manner, I’m extracting the email element from the submitted data here.
So this is the email element here. So if I go in here, again, exactly the same functions that I’m using. Only thing is I’m using extracting the email element. The last step is the send email notification, and here I’m going to the recipient is going to be a dynamic recipient. So that what we are saying is get the output of the extract email step, get the output of the extract email step, and send that email notification to that person. And in a similar manner, we are using the dir first name would be the output of the extract first name operation.
So now that your workflow is there, when you submit an adaptive form, this particular workflow will be triggered. And you can also see the executions of this workflow here. So if we go in here and see the runtime instances, so your flow was ran successfully.
So here are the inputs here. So that’s the actual submitted data from the form.
And this is the initialized variable. So we have initialized a variable called submitted data, which is of type string here. So it has the entire there. Then we converted that string to XML here. So that’s the XML.
And then we extracted the first name and the email. So this is the first name and the email. And then these values were used in our email notification template to send an email notification. So this is how you can extract field values or form values from the submitted adaptive form data in a Power Automate workflow and use it in an email. In the next video, we will take a look at extracting attachments from the submitted form.
recommendation-more-help
4859a77c-7971-4ac9-8f5c-4260823c6f69