top of page

CDI Blog

They don’t have to be ugly just because they’re automated - Customizing Workflow emails w/ HTML


By Kyle Knebel



Laserfiche Workflow has the tools to help us create good-looking HTML formatted emails. This month’s article will show some of the activities and techniques you can use to build well-formatted emails using HTML. Along the way, you’ll possibly learn some HTML coding tricks, too.


Here at CDI, we send our clients, upon request, a Case Summary with billed hours report via email. Here is an example.



A very simple email with a table and hyperlinks to Web Client documents might look something like this.



To build an email that uses HTML tables, like the one above, you’ll need to create workflow tokens that hold HTML and the data to be formatted. And you’ll format the entire table as “HTML” within the email body. Follow along in this step-by-step.


In our example, let’s use the following scenario. We want to send a weekly email that lists the documents created in the past 7 days. And we want to have live hyperlinks to each one of those documents.



Step 1:

In the workflow, we first need to run a search for the documents created this week using the “Search Repository” activity.


  • We need to get a date 7 days from the day this workflow runs (It should run Sunday evening). The Date Token Calculator activity can do this. Configure it to subtract 7 days from the current date.



  • Create the search and enter the search criteria using the “7 days ago” date token in the search syntax. I used this syntax: {LF:Name="*", Type="D"} & {LF:Created>="%(DateTokenCalculator_7 days ago)"}. Note: When possible, use the Advanced Search in the client and open the Search Syntax window to copy the search syntax and paste it into the workflow.




Step 2:

We need to build a token that holds the table header columns and allows the documents list to be appended to this token. Our report will have three columns: CreateDate, EntryID, and Doc Name.


  • Add the “Assign Token Values” activity. I renamed this activity as “Set HTML Header and Rows.”


  • Press the “Create…” button. I named this new token, “Report”. (You’ll use this in Step 5)

  • I also checked the box to “Allow token to have multiple values.”

  • In the first row we are going to insert some HTML. This will define the header columns. Insert the following HTML:

<tr> <th>CreateDate</th><th>EntryID</th><th>Doc Name</th> </tr>


<tr> means start of Table Row; </tr> means end of table Row

<th> means start of header cell; </th> means end of header cell




Step 3:

We need to create a token to hold the Web Client URL reference (called an “href”, the href attribute specifies the URL of the page the link goes to). This will create the correct hyperlink to open the document through the Laserfiche Web Client.


  • Add the “Assign Token Values” activity and press the “Create…” button. I named this new token “HREF.” I renamed the activity “Set HREF.”

  • In the first row we are going to enter your Web Client URL and some code to open the document viewer to the correct document.

  • Enter “HTTP://{webserver}/laserfiche/DocView.aspx?db={repositoryName}&docid=”




Step 4:

Next, we need to iterate through the output entries from the “Search Repository” activity to add each document to the HTML table token we created in step 2. But we only want to do this if there is a search result.


  • Add a “Conditional Sequence” activity and set the condition for the search result count is greater than 0.



  • Within this sequence, drop the “For Each Entry” activity, and connect it to the Search Repository activity.