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 :
- Powershell or Console application code that run every day, checking the current date and the validated date
- Workflow that wait during three years
- 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
- Navigate the the list settings, click Information management policy settings
- Click Item
- Click Enable Retention
- 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 :
- Navigate to Job timer definition in the central administration
- Search information management policy of your web application
- Change to minutes, 1 minutes
- 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