Skip to main content

Timer job or Scheduler using Workflow for SharePoint 2013 and Office 365

SharePoint online was a big step ahead by moving to cloud. It does bring in many advantages for the clients to get SharePoint with less investment.
Though it was a big move, it does bring in some restrictions to someone the classic SharePoint functionalities. One of them being the SharePoint timer job. Many of the developers relied on timer jobs to fulfill the complex functionalities that the business demand like schedule mails, daily data update and many more. Unfortunately for SharePoint online, timer jobs are not available by default. Yes, this was a move made as part of governing SharePoint in better way. We do have options, to have remote timer job deployed which runs outside of the SharePoint Server.

It is always great to have a alternative solution with whatever we have OOB in SharePoint. It is not a great solution as this can have impact on your server. But a good alternative on crucial situations. 😉

Let's see how to achieve this. We are using SharePoint workflow as workaround to achieve timer job functionality.

The basic idea behind this is to use the 'Loop with Condition' and 'Pause for Duration' actions available in SharePoint designer workflow.

So first let's create a site workflow using SharePoint Designer. We are going to use this workflow to run our desired functionalities every day (or any time schedule).

Create a new site workflow

The next step is to put a 'Loop with Condition'. The condition can be something which will be always true so that the scheduler will never stop.
In this solution, we are using 1 not equal to 0 which is always true.
You can even set an end date here to run scheduler till that date.


So, now we have to deal with the logic. Add all the functionalities you want to run, let it be sending mails or updating list. We are blessed with REST api usage inside workflow. You can do anything and everything with that. We will discuss it in another post. In this example, we will use Email these users action to send out an email every day.
Workflow Timer job
Loop with Condition : 1 not equals 0
Step : All functionalities can be added here.
Pause for duration: Pausing workflow for a day
Now we reach the final step. This is to pause the workflow temporarily till the next scheduled time. 
This can be achieved by using 'pause for duration' action in workflow. You can pause the workflow for a specific duration. Let's pause our workflow for a day.
So the workflow will stop for a day and restart the next day to repeat the actions. 
This will run on an infinite loop starting and pausing every day.


Once all this set up is done, navigate to site contents ⇨ Site workflows and start the workflow. 



Navigate to site workflow ⃗ click on the workflow to start the scheduler

Points to note, this is not a recommended approach and also require monitoring at regular intervals as it can be interrupted.
Hope this will help you 😊

Comments