Site icon @WonderLaura

Power Automate & Quick Parts

What does that title mean?  Translation: Create a Microsoft Flow that will let people fill out a form and place the field values in specific spots of a Word document, so that it looks like a filled-out legal document (or any kind of document).  Quick parts are not new.  They’ve been around since SharePoint / Office 2010.  This post is really just showing a way that they can be used in conjunction with Flow.

  1. Create a document library in SharePoint, and add new columns in the library, for each piece of information that you’d like to insert into your documents.  In my example, I’m adding these text columns: Customer, Hours, TaxID
    1. Create a new Word document in that library, or if you already have an existing document to use as a template, upload it to your new library.  Mine will be “SOW Library”.
    2. Once your document is in the library, then open it in MS Word.  (NOT Word Online)
    3. In Word, go to the Insert tab.  Click Quick Parts, and choose Document Property.  From the list of document properties, you’ll see your library’s metadata. Click a property to insert it in your document.
    4. Go through the process of putting your cursor in your document in each spot that the value belongs, and insert Quick Parts wherever you need them.  Here is an example.  Note that my font here is red, but is typically gray by default.
    5. Save your file in place, and close Word.  My file is called SOWtemplate.docx
    6. Go to Microsoft Flow., and create a new, blank Flow.
    7. Your trigger can be whatever you’d like it to be, but for this simple example, I’ll use a manual trigger, a button.  In your manual trigger, create input parameters for each of the values you’re using in the document as quick parts.

      Again, this is a simple example.  Your Flow could be getting this information from a SharePoint list form, from Salesforce, or PowerApps.  The objective of this post is to show you how data coming from *wherever* can be automatically inserted into a new Word doc.
    8. After the trigger, your first action will be a SharePoint action called Get File Content.  Remember that file you created at step 1?  That is the file that you want to get.
    9. Add a SharePoint action to Create File.  I just create mine right there in the same library, but of course, you could put it in a different library.  For the File Name, I’m using the Customer from the manual input parameters.  The File Content here is from the Get file content action.
    10. Add a SharePoint action to Update file properties.  For the ID, I picked the ItemID from Create File.  For the Customer, Hours, and TaxID, I used the 3 input parameters respectively.   For the file’s Title, I went ahead and used the Customer parameter there as well.  This step puts the metadata on that new file you created.  Those other fields, I blurred out because they are irrelevant to this demo.  At this point, you can save your flow, run it, and go to the library and see the new file there.

      The deal with Quick Parts, unfortunately, is that they’re a little weird when using Word Online.  The file looks fine when you open it up in the Word client software (on your computer), but in Word Online, the values don’t show in the Quick Parts.  Here’s the trick.  When people have read-only access to the file, the Quick Parts show correctly in Word Online, or when you preview the file.  Also, when you send it in an email it looks fine.  Here’s how to preview:

      Then here’s what the file looks like:
    11. For this example statement of work, I want to email it out to the customer, so here’s how to add a couple more actions to the flow, to automatically email that new file.  Add another SharePoint action, Get file content.  Rename it to Get file content new file.  For the File Identifier, use the ID from Create file.
    12. After that, add the Outlook action called Send an email (V2) (preview).  To keep this one simple, I’m just sending the email to whomever manually triggered the Flow.  In the subject, I mention the name of the customer (from my input parameters).
      For the attachment name, use File name with extension, from the Update file properties section.  For the File Content, get that from the Get file content new file section.
      Side note: Another idea, is that you could add another (text) input parameter in step 1 called Customer Email.  That way, this Flow could automatically send this to your customer.  Don’t use the input parameter type called Email though, because it only allows input of people inside your organization.  Use just a text one in order to type an email address of someone external.
      Here are some more details from that attachments section…

And here is a screenshot of the whole thing:


Have fun Microsoft Flow’ing!

Here are a couple of references of much older posts that I’ve written in relation to Quick Parts:

External Form Submit to SharePoint

SharePoint Power Hour 7/9/2014 Quick Parts in MS Word

Exit mobile version