Friday, July 27, 2012

Triggering a workflow when expiry date is approaching

Out of the box, SharePoint allows workflows or tasks to begin when a certain date is reached. However, there's nothing that will trigger a workflow when a date is approaching.  For example, I have a list of contracts that have expiry dates attached in a custom column.  I want an expiry notification to fire three months before that date.

I found a solution here - Item expiration reminders in SharePoint using workflow - but for some reason, the workflow didn't work as expected, possibly due to the structure of my data.  So I've made some changes, trimmed it a little, and present it below.

Only one additional column had to be created - named "Previous due date", it's a date column in which the workflow stores the current expiry date.  It may even be possible to remove this column entirely, but I've left it in to make it easier to check the progress of the workflow.

What the workflow does is: it stores a workflow variable called Alert Date, which is simply three months before the Expiration Date.  If the Expiration Date is after today, it will set the new column, "Previous due date", to the current Expiration Date, and also sets a workflow variable, "Original Due Date", to the Expiration Date.  It will then carry out two actions in parellel -

  • Wait for the Alert Date to be reached, and then send an email
  • Wait for the Expiration Date in the item to change, and then stop the workflow.
Since the workflow runs on change or create, we don't want the same workflow running multiple times on the same item because the item has been changed, so the second action takes care of that.

Here's the actual workflow:

Different views inside a document set

I have a site which has a large list of Document Sets, one for each customer.  These document sets are grouped by their country.  However, when opening the document set, the contents are also grouped by country, because by default, a document set uses the same view, and it's not smart enough to realise the grouping is for the document set, not the contents.

Easy solution I've just discovered (thanks to this blog post) -

  1. Create a new view, based on the original view, but without the Grouping
  2. Open the Library Settings, and select the Data Set from under Content Types
  3. Select Document Set Settings.
  4. Scroll down until you find the Welcome Page View setting - you can change the view here.

Thursday, July 12, 2012

SharePoint Lookup with Picker

A site I'm working on has a very long lookup list.  SharePoint 2010, by standard, only allows a dropdown for this, and that's just insane when you have thousands of items to choose from.  So I found the iLove SharePoint Lookup Field with Picker 2010 which allows the user to use something similar to the people picker, but with lookup entries.  Extremely useful and works perfectly, except...

The site uses Word templates, and the templates use SharePoint properties.  I'm getting some strange behaviour when using the Lookup Field with Picker: namely it's not possible to change the lookup value from Word.  I only get a single option - "1" - and two blank options.  When selecting the blank option, the "1" option vanishes from the document properties.

I'm now trying to find a way to display a dialog when the document is first created in SharePoint that forces the user to pick a selection from the lookup, and then not allow that selection to change.