How to Create a Scheduled Task in Sitecore

To Create a scheduled task in sitecore, first you must create a .net class which contains logic that you wish to execute.

Here is the small example when I run the Task Scheduler.

This method will trigger all the failed Newsletters user requests to the third-party service.

Namespace Feature.Newsletter.Jobs
public class JobTrigger
public void NewsLetter(Item[] items, Sitecore.Tasks.CommandItem newsLetterSignupCmdItem, Sitecore.Tasks.ScheduleItem newsLetterSignupScheduleItem)
// Put your code here.

Create a Command Task under /sitecore/system/Tasks/Commands/

Insert command template from Templates /sitecore/templates/System/Tasks/Command

Give the Type field enter the assembly qualified type and in the Method field enter the name of the method to be called in your class

Type: Feature.Newsletter.Jobs.JobTrigger, Feature.Newsletter

Method: mention the method name which needs to be executed. Example: Newsletter

Create a _Task Schedule under /sitecore/system/Tasks/Schedules/Job


Create a schedule to run the job.

Under the Command Field: Specify the path of command.


In the Schedule field: specify the time how often need the job to be run.

Schedule field will have several piped values.


Start Date: 20170208

End Date: 99990101

Days of the week: Calculate based on the days of the week no.

Sunday = 1

Monday = 2

Tuesday = 4

Wednesday = 8

Thursday = 16

Friday = 32

Saturday = 64.

Let say I want to run the job every day.

It’s going to be (Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday)

= (1+2+4+8+16+32+64)

= 127

The minimum interval the task is to be run in HH.MM.SS format

The task is setup now to run at specified interval.







How to Create a Scheduled Task in Sitecore

Leave a Reply

Your email address will not be published. Required fields are marked *