SharePoint reminders: Don't forget, always remember!
Wake up! Wake up! Wake up! - Please no… just ten more minutes! Lots of us talk like that every morning with their alarm clocks. Usually we press the sleep button and after several minutes the clock rings again. But what happen if it does not? In most cases the result is oversleep and being late to work. Now let’s think about a situation when a friend calls you in a day and asks for help. You say “Call me in the evening, I will help you” and usually forget about it. Unless he or she calls you later you will not remember to help them.
Where else people act like that? In a professional environment of course. It is quite likely that in your workplace you receive automated emails with information about some task to do. But, as you work on other tasks already, you would like to save it for later. Sometimes you will remember about a new task, but in lots of cases you will simply forget about that so it would be the best if someone reminded you later. Especially if you are a boss – you are probably tired of reminding others about their work and would like your IT system to do it.
In this post I will describe several ways of achieving that using Microsoft SharePoint and its extensions. I will cover differences between them as well as their advantages and disadvantages. I hope that after reading it you will know which method fits your needs.
At first we need some environment - let it be a SharePoint web site with a simple list. The list contains three columns: Title (of an issue), Assigned to (some employee) and Due date. It looks like this:
Simple SharePoint list with assigned issues
How will the typical scenario look like? We have an issue (task, work item etc.) and we would like to inform a user that he or she has something to do. We would like to keep notifying that person for as long until the work on the issue starts. But what to do when due date approaches? The person who created the issue should be probably informed that something goes wrong. So we need a mechanism that sends an e-mail to the assigned user every day until he or she picks up the task (let’s debate later what does it mean) or, when due date approaches, alarms the user who created an item.
When you think about notifications in SharePoint the first thing that comes to mind are alerts. From a browser level you can simply set an alert on a library or an item to keep you (or other people) informed about what is going on. Alerts however work only when something happens: an item is added, changed, deleted etc. We will get information when an item is created, but later, if we want to remind a user about his task which remain unchanged, that is not enough. We need something more powerful.
Typical second step
Usually if there is no option to do something in a browser the second step is SharePoint Designer where can create declarative workflows. Let’s try!
The SharePoint Designer workflows may include several activities which are interesting for us, like:
- Send Mail, with the possibility to select as recipient Current Item Author and Current Item field
- If Activity, which can check and differ values of Current Item fields
- Pause activities, one for waiting for some time period and the other for waiting until selected date, which can be looked up from Current Item
Putting it together gives us the workflow below:
A simple workflow created in SharePoint Designer
The workflow sends an e-mail after we create an issue (great!), waits until due date and notifies the author of the issue that it has not been picked up yet (even greater!). But wait, where is the most important thing – daily reminding?
Unfortunately we can’t do that. In SharePoint 2010 Microsoft removed from SharePoint Designer the Loop activity, the one that we really need for daily reminding. We still can make some workarounds, like putting Pause activity inside If and then, inside that one, other If with other Pause. The workflow waits, checks, waits, checks, etc., but only for the selected number of times. It could fit in some scenarios but in most cases we would need to find some other way.
The third option, most powerful but also most time consuming, is Visual Studio. To use Visual Studio and develop SharePoint solutions we need a programmer, so the description below was written with programmers in mind – beware!
We can develop custom code for timer jobs that runs in selected time spans. At start we need to have a SharePoint type project (e.g. SharePoint 2013 – Empty project) deployed as a farm solution. Then we can create a class for our timer job which should inherit from SPJobDefinition. Remember to create two constructors: one with parameters for initializing a new instance in your code and one without parameters for SharePoint – it is needed for deserialization. The whole class will look like this:
click image to enlarge
Next step will be the filling Execute method. We need to open objects like SPSite, SPWeb and SPList – those ones where we store our issues.
Now we can load every issue which waits to be picked up. The best for it will be SPQuery which will load every item where Status equals Assigned and Date is greater than today’s date. For every item we will send an e-mail to Assigned To person with notification.
click image to enlarge
We should do similar thing for issues that are over due date, but this time we will send e-mails to authors of documents.
click image to enlarge
We need also a little code for installing and uninstalling the timer job. That code can be started from a farm feature or a farm configuration page.
click image to enlarge
At last we have our solution. It meets our scenario: reminds people about their issues every day and after due date alerts the author. And it is not very complicated. Is it?
But wait – we have a coded solution (so we need to be a programmer or have one) which contains hard coded data about site, list, mail content etc. If something changes we will need to update the solution and redeploy it. It takes time. Also we do not have anything to configure a solution, install the timer etc. So what should be next?
To have a full solution you need at least:
- Farm feature, for installing/uninstalling timer job
- Configuration page (you need to decide where to put it – farm, site?) allowing at least to configure e-mails, site and list.
- Some store where you should keep your configuration data
You need also to decide how exactly you would like this to work. You have to remember that our scenario is very simple. Big companies may have very specific policies about such reminders, so you can have lot of work with more complicated scenarios and may need to create custom solutions for different departments. It could take from several hours up to several days. Sounds ridiculous for such a simple task. There should be some simpler method, shouldn’t it?
There are plenty of 3rd party solutions for SharePoint - I will show that some of them not only support our scenario but also processes that this scenario is part of, so you can develop much more that only reminders. I will present their advantages and disadvantages, i.e. what you can do with them in context of reminders and what you cannot.
Nintex Workflow claims that it is “Workflow for Everyone,” so let’s check if it is for us too. In our scenario we can use activities similar to SharePoint Designer like Send Notification (i.e. send an e-mail) and Pause for (i.e. Delay) and include as well a loop activity. Now we can send an e-mail and wait until due date or until the assigned person picks up an issue. The workflows checks if one of those conditions is met. Then it can move forward or send info to the author (i.e. when an issue is not picked up and due date is passed). Our workflow will look like this:
An assignment workflow created in Nintex Workflow
As you can see we accomplished our task. For constructing such a workflow you need less than an hour. Great! Isn’t it? Mostly. But what happens if we would like this workflow to manage our issue process further? The workflow doesn’t know when an issue is picked up. What if we would like to send an e-mail to the author of the issue (in many companies we need such things)? Or if we would like to send back an issue to the author to update it? Or if after an issue is completed the author decides to send it back to us? We would need to reassign the issue and always send reminders for the assigned person and also for the author. Like I mentioned it is a rather complicated task.
Simple and powerful
Datapolis Workbox is a graphical designer for state machine workflows in SharePoint. What does “state machine” mean? To keep it simple it will help us support advanced scenarios, much more complex than the one we described.
In Datapolis Workbox every state of a workflow has a name which is shown in a special column. We do not have to create custom status column as in the previous examples, because it will be created automatically. So what states do we need? Of course one: “Assigned” (and maybe some more for more complicated scenarios, but we will get back to it later). Let’s build our simple scenario:
click image to enlarge
An assignment workflow created in Datapolis Workbox
We have now one state – Assigned, and two actions – Remind and Start work on issue. What are those actions? They are transitions from one state to another, which can be invoked manually or automatically. Actions can include some activities like sending an e-mail etc. When a new item is added our workflow starts automatically and goes to the Assigned state. In SharePoint it looks like this:
Datapolis Workbox actions visible in SharePoint list
A user can just click Start work on issue to move the workflow to the next state (which in this case is the end state). That move includes, like I mentioned above, some activities that will, for example, send an e-mail or update item (or do lots of other things).
But wait – what with our reminders? We just need to set them up. We will use Remind action which is a loop action that allows to go back to the same state. In Datapolis Workbox we can set up something called Self-timer. That mechanism provides possibility to launch an action automatically after (or at) selected time or if chosen conditions are met. Its configuration is very simple – you just click on an action, then on Self-timers button and then just click “Add new self-timer”. The window below will pop up.
The self-timers window in Datapolis Workbox
The edited action will contain an activity (see the picture below) that checks if due date is passed. If so, it sends an e-mail to Author or, if not, it sends an e-mail to Assigned person.
Send an e-mail activity in Datapolis Workbox
So how does the process work now? It checks daily if due date is passed and then sends an e-mail – to Author or to Assigned person. If an item is not assigned it does not send an e-mail at all. So we can celebrate – we have accomplished our scenario.
But if it is the same as before why did we do it? Is there a reason? Yes - we can now stop waiting and move our workflow further, so that it can support the whole process. This workflow does not perform only one waiting activity. It waits for several things at the same time – for the self-timer which launches “Remind” action or for a user who launches “Start work on issue” action. And it is not all. For example we can move workflow to other state automatically if due date is passed, send reminders to the author in the other state and, if the author changes something or requests additional work, we can go back to the earlier state and send reminders to the assigned person again. In more complex, real-life situation that workflow can look like below:
click image to enlarge
A sample workflow created in Datapolis Workbox
The workflow contains the whole process that supports assigning, working and checking of an issue. It can request additional work (Assigned person) and more information (Author). It also supports several ways of sending reminders to Assigned person or Author (when due date is passed or when there is a request for additional info). Moreover, as you can see (look at blue clock icons on actions which symbolize self-timer) the workflow automatically moves to “Due date passed” state if due date passes (self-timer set to the date loaded from Current Item).
You have to remember that in real life you will also need to create some roles in a process. It is rather hard to support it dynamically in SharePoint, but in Datapolis Workbox you can just add roles using the graphic designer, include them in special activities and use in actions, so only those entitled to see some actions will see ones.
Summarizing, we have accomplished our scenario. It took us the similar amount of time than in Nintex. The advantage is that in the next several tens of minutes we made a really complex solution that would take days or even weeks in code.
So is there a simple answer which tool we should use? As you probably already guessed – of course not. It always depends on what do you need. Let’s summarize our research and take a look at tools we’ve used:
- Browser – you can set up alerts through it. Enough for very simple scenarios when you would like to see changes on a list or a library.
- SharePoint Designer – more effective, but support only simple sequential workflows, without repeating of reminders.
- Visual Studio – fulfills every scenario. And your time as well. Use it when you need a deeply customized coded solution.
- Nintex Workflow – supports easy creation of advanced reminders as well as development of sequential workflows.
- Datapolis Workbox – allows to create multiple reminders inside complex state machine workflows.
It is really easy to choose a wrong tool, so you should always think and analyze before. Maybe your needs can be changed? Maybe you do not need something complicated? Maybe you can discuss how you should really remind people about their assignments? Or perhaps you could create your solution partially by a 3rd party workflow tool and partially by coding? Remember that a good tool can save you much time, but knowing how you want to achieve a solution and choosing the right tool, even not the best on the market but the best for the current project, can not only give you spare hours, but really drive you to success.
|About the author:
Tomasz Głogosz is the senior .NET developer at Datapolis and the architect of Datapolis Workbox.