Sharepoint Solution Series – Inform by email after 3 years that a request has been is validated

Business objective

Once a Vendor Qualification Request is validated, the business team shall receive an email after 3 years informing that the request is about to expire. This solution can be achieved by a super user as it doesnt require programming skills.

Technical solution

How to trigger an email after X days or X years using SharePoint Out of the box features ?

Create a sharepoint custom list, configure the form. Once validated a workflow is trigged to get approval (this is not covered in this tutorial)

To trigger an email after three years multiple solution could be used :

  1. Powershell or Console application code that run every day, checking the current date and the validated date
  2. Workflow that wait during three years
  3. Retention policy (configure the list to trigger a SharePoint 2010 Workflow after 3 years)

The solution three is to me the best as it is the quickest, safest. Solution 1 requires more development time and potential bugs. Solution 2 is exposed to platform crash and so on failure.

Implementation

Create the workflow that email

Create a SharePoint 2010 type workflow (2013 workflow type is not supported), that send an email, name it Inform about expiring.

Configure the retention on the list

  1. Navigate the the list settings, click Information management policy settings
  2. Click Item
  3. Click Enable Retention

  4. Click Add a retention stage as below, set 0 days for testing purpose (you dont want to wait 30 days J), select the workflow that shall trigger (in that case we created a SharePoint 2010 workflow that triggers an email)

Configure expiration job timers

You must change the job timers, otherwise it might take 7 days to trigger, as it is by default configured this way :

  1. Navigate to Job timer definition in the central administration
  2. Search information management policy of your web application
  3. Change to minutes, 1 minutes

  4. Search Expiring policy timer job, set it to 2 minutes

Wrap up

Configuration are done, now create a list item and wait 5min, an email shall trigger.

Each time you modify the workflow, you have to navigate back to the retention rule and select the last version of the workflow.

To finalize the solution, modify the retention stage with the correct timing (in my case : Create date + 3 years) and set the timer job to daily, run the expiration job before the information management policy one

Advertisements

Speedup Javascript Development (when using Content or Script Editor)

Creating webpart and script editor is a quick (dirty J) way to deploy a component in any SharePoint or Office 365 version.

To optimize this development process, version the code in git/tfs and fasten the deployment, you can use gulp watch method inspired from Wictor Wilen.

I got this working thanks to my colleague Max (twitter)

Though the recommended approach for non-SharePoint 2016 (feature pack 2, which includes spfx webpart) environment is to create a typescript webpart, to allow easier migration to SPFX in future.

—> Click for the demonstration

Continue reading “Speedup Javascript Development (when using Content or Script Editor)”

Create a free website or blog at WordPress.com.

Up ↑