Monday, March 7, 2016

Sending Reminder via workflow

I was asked to create a workflow for a document library. This is sometimes known as a Document Management System (DMS). The document library has metadata fields. This means that there will be a second popup window after the file upload “Add a document” window. The workflow “Start workflow automatically when an item is created” and “Start workflow automatically when an item is changed”. The workflow has five stages. There are two types of users, an Owner and an Approver.

An owner (which is the “Created By” field renamed) is the user that upload a document and an Approver approves or rejects documents. The stages are Draft, Pending (Valid Owner and Invalid Owner), Approve and Reject. The users are updated by email at every stage of the workflow. In addition to this, the workflow should sends reminders to the Approver to approve or reject a document upload if they haven’t done so within a time period. It also sends emails to the approver in advanced to review a document prior to the review date. To facilitate this, I created three calculated columns named “Due Date”, “Reminder Date” and “Review Date”.  

A reminder email is sent only on the “Due Date” which is 7 days after the document has been uploaded if the approver hasn’t approved or rejected that document. After the document has been approved or rejected, a reminder email is sent 7 days before the “Review Date”, this is the “Reminder Date”. Review Date is “Modified” plus 180 days. Reminder date is Review Date minus 7 days. Seems simple enough right? Well I came across a few issues.

Using the “Pause for 0 days, 0 hours, 0 minutes” action wasn’t a good idea as the workflow did not work. No emails where delivered. It is as if the workflow pauses mid-way through in the pending stage. I tried a few tricks that did not work. I decided to separate the workflows. By that I mean have a second workflow, a 2010 workflow to be exact. In this workflow I had all the reminders. Again, same as the 2013 workflow this one “Start workflow automatically when an item is created” and “Start workflow automatically when an item is changed”.

As shown below, a Due Date email is sent, when it is today (ignoring time) and when Status (a local string variable based on Approval Status) equals 2 which is the Pending Approval Status. An email is sent also when Reminder Date equals today (ignoring time) and Status equals 0 or Approved Approval Status. Finally, an email is sent when the Review Date equals today (ignoring time) and Status equals 0 or Approved.

In conclusion, I had the bulk of my conditions and actions are in one workflow and the reminders are in another. I have seen different methods such as using “Add 0 months, 0 days, 0 hours, 0 minutes to date (Output to Variable: date)”.

However, I prefer using calculated columns to send reminders because it is simple and it works!

Figure 1-1: Reminder stage


by Larry Saytee via Everyone's Blog Posts - SharePoint Community

No comments:

Post a Comment