At Laser Works, engineering design documents are very important to the business. Project stakeholders would like to be notified any time a proposed product changes direction or if new requirements are added for a future product release. Laser Works uses Laserfiche Workflow to email the stakeholders every time an update is made to an existing document in the “Engineering-Design Documents” folder.

What does the workflow do?

A workflow monitors the “Engineering-Design Documents” folder and its subfolders for any changes to documents. Stakeholders can subscribe to emails about changes to documents in this folder by adding their email address to a field on the folder. When a change occurs, the workflow gathers information about the changed document (version comments) and emails the stakeholders.

workflow_subscriber1

Laser Works’ users can view documents either through Laserfiche Web Access, Laserfiche Mobile or the Laserfiche Client, so Laserfiche Workflow will email Laserfiche Web Access and Laserfiche Mobile URLs and a Laserfiche Client shortcut.

Laserfiche setup

In order for this workflow to run correctly, Laser Works has configured the following:

  • The “Engineering-Design Documents” folder is set to automatically place new documents under version control.
  • Project stakeholders subscribe to emails on the monitored folder by adding their email addresses to a multi-value text field called “Notify Me.” Email addresses can be added to or deleted from the field at any time.

workflow_subscriber2

Designing the workflow

The following workflow starts whenever a document is modified.

workflow_subscriber3

Before it can send out an email, Laserfiche Workflow needs to gather the list of email addresses from the “Notify me” field and the version information on the document. Since these pieces of information do not depend on each other, they can be retrieved simultaneously with a Parallel activity.

Branch 1 – Retrieving the list of email addresses

This branch retrieves a list of subscribers to the “Engineering-Design Documents” folder.

Before being able to retrieve field values from an entry, the workflow must first find the entry. Using the Find Entry activity, Workflow can locate the “Engineering-Design Documents” folder in the repository.

workflow_subscriber4

Laserfiche Workflow reads the email addresses from the “Notify Me” field by using the Retrieve Field Values activity. Note that the Field Value Source property is set to use the “Engineering-Design Documents” folder.

workflow_subscriber5

Branch 2 – Retrieving version information from the document.

This branch retrieves comments made by the person who last reviewed the document and turns them into a token.

An SDK Script activity can be used to access version comments. This C# script obtains the latest version comments from the document and converts it into a token called “DocumentVersionComment.” The script will return “No version comment in this update” if the user does not specify one when creating the new version.

namespace WorkflowActivity.Scripting.Readversioncommentsastoken
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using LFSO90Lib;
/// <summary>
/// Provides one or more methods that can be run when the workflow scripting activity is performed.
/// </summary>
public class Script1 : SDKScriptClass90
{
/// <summary>
/// This method is run when the activity is performed.
/// </summary>
protected override void Execute()
{
StringBuilder s = new StringBuilder();
LFDocument d = ((LFDocument) this.Entry);
LFVersionControlInfo vControlInfo = d.VersionControlInfo;
LFVersionHistory docVersions = vControlInfo.VersionHistory;
LFDocumentVersion latestVer = docVersions.Item[docVersions.LatestVersionNumber];
if (latestVer.Comment.Length > 0)
{
s.Append(latestVer.Comment);
}
else
{
s.Append("No version comment in this update.");
}
MsgBox(s.ToString());
this.SetToken("DocumentVersionComment", s.ToString());
}
}
}

The Generate Web Access URLs activity is used to create both a Laserfiche Web Access link and a Laserfiche Mobile link to the modified document.

workflow_subscriber6

Once all the required information is gathered, Laserfiche Workflow sends an email to the people who subscribed to the document.

  • The multi-value token (obtained from the “Notify Me” multi-value field) is formatted as a semi-colon-delimited list and used to populate the “To:” property in the Email activity.
    workflow_subscriber7
  • The version comments are used in the email body. To make the email easier to read, it is formatted in HTML.
    workflow_subscriber8
  • A shortcut to the document is attached to the email for users to view through the Laserfiche Client.
    workflow_subscriber9

Starting rule

This workflow runs whenever a document is changed in the “Engineering-Design Documents” folder.

Within the “Engineering-Design Documents” folder there is a subfolder called “Archived Discussions” which the stakeholders do not need to monitor. This “Archived Discussions” folder is excluded from the email notifications.

workflow_subscriber10

Once the workflow is published, stakeholders will receive an email every time a document in the “Engineering-Design Documents” folder is modified.

Note that a starting rule can be added so that the workflow also runs whenever a new document is created in the “Engineering-Design Documents” folder, not only when a document is changed.

Watch this video to see how to create a similar workflow:

Some of the products and services listed on the Laserfiche Solution Exchange were not developed by Laserfiche. The recommendations and opinions expressed on the Laserfiche Solution Exchange are those of the person or persons posting the recommendations only, and they do not necessarily represent Laserfiche's opinion or recommendation of the product or service being reviewed. Laserfiche disclaims all liability resulting from your purchase or use of any non-Laserfiche software product or service listed on the site.