Converting (InfoPath / Nintex Forms/ PowerApps based) List Items using the Muhimbi PDF Converter

SharePoint allows the List Item Data Entry Form to be customized using PowerApps, InfoPath, Nintex Form etc. However, data filled out using this facility is not stored as ‘real‘ forms and therefore converting it to PDF has always been a challenge.

In this Blog post, we will use the Muhimbi “Convert HTML to PDF” Microsoft Flow action to Convert a list item to PDF, regardless of the Forms technology used to populate the data in the list item. In this example we use PowerApps to populate the data, but the instructions are the same for all other technologies as the workflow is triggered when the List Item is updated.

This works equally well using Muhimbi’s REST API and the SharePoint Designer workflow actions.


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 PowerApps. This is not a generic PowerApps Tutorial.


To break down the complexity we will divide the blog post into two parts:

  • Part 1: We will Customize a SharePoint List in PowerApps to capture user data.
  • Part 2: Create a Microsoft Flow to use the captured data, enrich it with HTML, and convert it to PDF and then write back the generated PDF to the SharePoint Document library.

Let begin with Part 1: Customize a SharePoint List in PowerApps to capture user data.

Step 1: On a SharePoint Online site, create or navigate to a list, make sure Modern View is enabled for that list, and then add these columns:

  • Title (Single line of text)
  • Email (Single line of text)
  • Feedback (Multiple lines of text)
  • Satisfaction (Choice)

Step 2: Customise the SharePoint Online Form in PowerApps.

• Open the list that you just created, on the command bar, select PowerApps > Customize Form.

Customize form

Step 3:  PowerApps shows your form, but it contains fields that you don’t need.

  • In the Data pane, clear the check boxes for the Attachments fields. The field will disappear from the form, leaving only the fields that you added.

Remove.png

Step 4:  For this demo, We will be adding basic customization to the Form.

  • We will select a Theme. Click on “Home” Tab > Theme (Its just going to a basic form with Blue color background).

Theme.png

  • Open the File menu, select Save, and then select Publish to SharePoint twice.
  • In the upper-left corner, select the back arrow, and then select Back to SharePoint.

Part 2: Create a Microsoft Flow to use the captured data, enrich it with HTML, Convert it to PDF and then write back the generated PDF to the SharePoint Document library.

Although it is possible to integrate a Flow Directly in PowerApps, this becomes problematic when rolling out the PowerApp to multiple users as they will all need to manually enter the account credentials for external services such as the Muhimbi connector. For this reason, it is generally recommended to decouple the Flow from the PowerApp.

Step 5: For this demo, we will use the SharePoint Online Trigger “When an item is created or modified“, add the “Site Address” and “List Name”.

When an item is created.png

Step 6: 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>
<head><style>
p.solid {border-style:solid; color:#3333cc; background-color:powderblue }
</style></head>
<body><p class="solid">
Title:<br />
Email:<br />
Feedback:<br />
Satisfaction:<br />
</p></body>
</html>

ConvertHTMLtoPDF

The sky is the limit when it comes to HTML, but let’s not go overboard for this simple example. Insert the following HTML in the Source URL or HTML field.

Step 7: Use the “Create file” SharePoint action to create the PDF document into SharePoint document library.

  • File name: For this Demo, we will use “Title” (output variable of the “When an item is created or modified” action) and use the Expression “utcNow()” .pdf to create a unique filename.
  • File content: Processed file content the (output variable of the “Convert HTML to PDF”)action.

CreateFile

Step 8: All done! Now it’s time to test our Flow.

  • Navigate to SharePoint Online and create a list item.
  • The Flow will be triggered automatically.
  • You should have a PDF generated in the Destination document Library.

Flow.png

Happy Converting…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s