The Problem
For whatever reason, the Microsoft Forms Trigger and Action in Power Automate do not return the Form’s title / display name. I’m sure there’s a good reason, still, sometimes people want to reference the form’s title elsewhere in the flow!
Example MS Trigger
Example MS Form Response
The Static Solution (Quick)
You could hard-code the form’s name in a compose or variable inside the flow for a static solution. This is quick and easy.
The Dynamic Solution (Slightly less quick)
What if you want to make copies of the flow? What if the form’s name is updated by someone later?
Ideally, we would want a dynamic solution and thanks to the Entra ID “Invoke An HTTP Request” connector action, there is one.
FormAPI Endpoint
The endpoint we need looks like the following:
https://forms.office.com/formapi/api/{tenantId}/users/{userId}/light/forms('{formid}')?$select=formsProRTTitle,id
All you need is:
- tenant id
- user id
- form id
You can find your tenant id and user id in a number of places. You can always find it using “Inspect” on your forms.office.com page.
- Open forms.office.com.
- Pop open your browser’s inspect tool. Open the “Network” tab.
- Filter for “https://forms.office.com/formapi/api/“.
- Open one of the calls in the log and copy your tenant id and user id from the Request URL.
Inspect the forms page:
Example Request URL in Inspect Network Tool:
Add Invoke an HTTP Request (Entra ID) Action
Add the action and set up the connection.
Setup the Connection or Connection Reference
It’s best to use connection references. You can add one in your Solution. Make sure to give it a good name that lets you know what it is.
Add a new connection
Use the base URL for Microsoft Forms. Click “Create” and log in to complete the connection.
Assign your new connection to the “Invoke an HTTP request”.
You can find your connection reference by name.
Or if you’re just using a connection, select the last connection in the list as it will be the one you just created. You can double check that you have the latest one by viewing its details.
Add the relative URL for the Form API to get the Form Title returned.
Here in my example I have my tenant id and user id saved in compose actions, and the form id is coming from a trigger input.
/formapi/api/@{outputs('Compose_Tenant_ID')}/users/@{outputs('Compose_User_ID')}/light/forms('@{triggerBody()?['text']}')?$select=formsProRTTitle,id
It looks like this.
Reference the Form Title from the Invoke an HTTP request output.
This is what the output of “invoke an HTTP request” looks like in this flow:
Test Example
Here I’ve built a child flow with a manual trigger that can be called by other flows. I have multiple simple flows set up with Microsoft Form triggers for different forms, that call this flow as a Child and pass it the Form ID and Response ID.
This flow find finds the title and saves it in a SharePoint List.
Thanks for reading!
Comments