Generate an HTML document with dynamic data

Document created by brad.orluk@nintex.com Employee on May 18, 2016Last modified by brad.orluk@nintex.com Employee on Apr 27, 2017
Version 2Show Document
  • View in full screen mode

This walk-through and workflow demonstrates how you can dynamically generate an HTML document using Nintex Workflow.

 

AuthorBrad Orluk
Long Description

An interesting scenario I ran into is one where a user wanted to create a form document quickly and easily (without having to call IT or leverage an outside solution or functionality such as InfoPath, Word Automation Services, etc.) that had dynamic text data from a SharePoint list.

This sounded like something that could be accomplished with some very basic HTML (full disclosure, I am NOT a developer and you don’t need to be to do this. So feel free to cut and paste some Google’d HTML “code”, for drawing an HTML table or use what I stuck into the Build HTML form action and you’ll be in business! :).

So, I went ahead and built a Nintex workflow that takes the column data entered into the list, builds a file name and performs an error check to determine if the file already exists in the library, generates the HTML document dynamically and then writes that document into a library.

Dependencies

N/A

Support Info

Generate an HTML document with dynamic data | Brad’s Blatherskite Blog

Compatibility

Nintex Workflow 2016

Nintex Workflow 2013

Nintex Workflow 2010

Platform

SharePoint Server 2016

SharePoint Server 2013

SharePoint Server 2010

Screenshots

docgen331144

The simple HTML document generated with this workflow

Setup

A Document Library named Customer Forms Library – (Template here)
A Custom List named Customer Data List – (Template here)

Building the Workflow

You’ll need to create some variables to store data for this workflow:

  •          textFileName – Stores the name that the document will called once saved into the document library.
  •          textHTMLRecord – The documents HTML framework will be stored here along with the dynamic data to be written to the record.
  •          textDestinationURL – The URL (including the filename) for where the file should be written to.
  •          coLib – A collection to store any documents found with the same name that already exist in the docment library.

Now we need to drop some actions onto our design canvas that perform the following actions:

  1.        Generate the destination URL.
  2.        Set the output filename.
  3.        Query the document library for existing files.
  4.        Set a condition to
    •     Log the existence of the file into the workflow history and then send a notification to the initiator.
    •     Generate the HTML framework and dynamic data that will be written to the document and then use the web request action to put file the into the document library.

docgen331141

Below is how I configured the Build string action. As you can see the forms HTML structure is simply saved into the action and then references to the column data are inserted as necessary.  It’s also worth noting, since I’m saving this out as an HTML file, you CSS wizards out there could probably dress this form up quite a bit more than I did!:)

docgen331145

Outcome

Now, when an item is created in the Customer Data List it will take the columns that we defined inside of the build string along with the HTML framework for the form and write it out to the document library. This could be quite helpful when creating a permanent record or a more attractive document that can be published to a web site or communicated via email or any other use you could imagine!

Additional Information

I hope this post helps. Feel free to grab a copy of the workflow export via the attachments control below. Feel free to let me know what you think and go ahead and share your experiences in the comments below!

Nintex Xchange Terms of Use Policy

Nintex makes no warranty or guarantee about the reliability, performance, quality, or functionality of any assets, and any assets you install are therefore provided as is. By downloading this asset, you agree to the terms of use.

Outcomes