Microsoft Forms provides us with a quick and easy way to create surveys, quiz’s etc. The response to these Forms can be saved in SharePoint list or can be sent over email using Microsoft Flow but how can we save the responses as a PDF in the SharePoint Online Document Library?
In this Blog, we will use the Muhimbi “Convert HTML to PDF” Microsoft Flow action to Convert the Microsoft Form response to PDF and save it in a document Library.
Please make sure the following prerequisites are in place:
- An Office 365 subscription with SharePoint Online license.
- Muhimbi PDF Converter Services Online full, free or trial subscription(Sign up).
- Appropriate privileges to create Flow.
- Working knowledge of SharePoint Online, Microsoft Flow and Microsoft Forms.
For this demo, we will convert the Sample Microsoft Form (below) to PDF.
From a High level our Flow will look like:
Add the “When a new response is Submitted” trigger action. It will trigger the flow when a new response is submitted.
In the trigger action specify the “Form Id” of the Microsoft Form.
- Add the “Get response details” action. This action retrieves a form response.
- Specify the “Form Id” of the Microsoft Form
- For the “Response Id” add the output “List of response notifications Response Id” of the “When a new response is Submitted” trigger action.
- This is where the real Magic happens. Add the Muhimbi “Convert HTML to PDF” action.
- Copy the HTML fragment provided below in the ‘Source URL or HTML’ area in the Muhimbi ‘Convert HTML to PDF’ action and then insert the various list fields in the appropriate places just before each line’s <br/> element.
<html> <body> <h2>Help us Improve</h2> Responders Email:<br /> Submission time :<br /> Feedback:<br /> </body> </html>
Use the “Create file” SharePoint action to write the PDF document to the SharePoint document library.
- File name: For this Demo, we will use “Feedback(Responder’s Email).pdf” (output variable of the “Get response details” action).
- File content: Processed file content the (output variable of the “Convert HTML to PDF”)action.
All done! Now it’s time to test our Flow.
- Open the link\URL for the Microsoft Form in the browser and submit a Form.
- The Flow will be triggered automatically and a PDF should be created in the SharePoint Document Library.