SlideShare a Scribd company logo
2
Most read
12
Most read
July 2024
Sitecore Training
Scheduler
s &
Agents
• What are Schedulers in Sitecore?
• Overview of Schedulers
• Scheduler Configuration
• Flow and example of Scheduler
• How does Scheduler Run?
• What are Sitecore Agents?
• Demo
Agenda
An investment in knowledge
pays the best interest.
– Benjamin Franklin
Schedulers Overview
• Automate tasks to perform pre-defined activities.
• Provides you the flexibility to trigger an action when specific conditions are matched.
• Allows you to perform routine task at a specific intervals.
• Easy and straightforward approach to run code logic at specific intervals.
• Examples of scheduler:
 Send an Email at a specific interval based on the conditions.
 Read a third-party URL and Create + Publish Items programmatically.
 Go through all the extranet users that exist in Sitecore and perform some activity on their
last login or send an email to stack holders if the users have updated the profile in the last
week.
 Periodically unlock the items that have been locked by different content authors.
• We can configure scheduled tasks in the Sitecore under the following location
/Sitecore/System/Tasks
• Mainly there are two elements in Sitecore tree that
needs to be configured for a scheduler configuration:
1. Schedules
 This has the data on when a command needs to be
called, at what time interval and has the data on when
it’s Last Run.
2. Commands
 Custom logic (code) that must be executed when the
scheduler executes the TASK.
Schedulers Overview
There are three main steps that a developer will do to implement
a scheduler in Sitecore.
Step 1) Writing your code that will be executed when scheduler
runs.
Step 2) Create the command item and provide the type and
method name.
Step 3) Create the scheduler item and assign the command
item created above and do its configuration.
Schedulers Overview
• Create your own class and write the code that needs to be executed when scheduler
runs.
• The method defined in this class will run within a specified interval and the code in this
method will be executed every time.
• Array of the items of type Sitecore.Data.Items.Item
• Sitecore task CommandItem of type Sitecore.Tasks.CommandItem
• Sitecore task ScheduleItem of type Sitecore.Tasks.ScheduleItem
Commands Code File – Step 1
• To call the method from a scheduler create a new command under the following node:
/sitecore/system/Tasks/Commands
• Type – Refers to your Namespace with
Class Name and Assembly qualified type.
(Project.Features.Items.Tasks.CreateAndP
ublish,Project.Features.Items)
• Method – The method name in your class
to which the control will be passed.
Commands Item In Sitecore –
Step 2
Scheduler Item In Sitecore – Step
3 • To call the new command create a new scheduler item under
the following node:
/sitecore/system/Tasks/Schedules
Command: Select/Specify the command path.
(Command created in earlier step)
Items: This is where we declare the Sitecore items array if we
wish to populate it in our class method. It can also be used to
send parameters for your custom class logic.
Schedule: Specify the time interval.
i.e., how frequently the job should run.
Last Run: Indicates the previous run date/time value.
Async: By checking this box, the command will run
asynchronously
Auto remove: We can use this field to remove the schedule
definition item automatically when the task expires.
Schedule Field: The configuration setting for the field named ‘schedule’ uses a pipe
separated string as given below, which determines when the task should be running:
Start/End Timestamp Format – YYYYMMDD
• If you want to start the scheduler after a specific date then you can mention the same in
this timestamp and it will execute accordingly.
• If you want to ensure that the scheduler should not execute after a specific date then you
can mention the same in this timestamp and if you don’t have any specific end date then
you can set it to maximum – 99990101
Scheduler Item Configuration
{start timestamp} | {end timestamp} | {days to run bit pattern} |{interval}
Days to run
• It uses a 7-bit pattern that determines, the days when a task must run:
1 = Sunday
2 = Monday
4 = Tuesday
8 = Wednesday
16 = Thursday
32 = Friday
64 = Saturday
• Days to run is the sum of the day number when the task must run.
• To run the task on Saturday and Sunday, add the values, 1+64 = 65.
• To run the task every day the number will be 127 i.e. sum of all the days
(Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday) =
(1+2+4+8+16+32+64) = 127
Interval
• Interval = HH:MM:SS
{start timestamp} | {end timestamp} | {days to run bit pattern} |{interval}
Scheduler Item Configuration
InitializeScheduler - Processor
Initialize pipeline includes a processor
Sitecore.Pipelines.Loader.InitializeSched
uler
If we remove this InitializeScheduler
processor from the initialize pipeline
then none of our scheduler / agent will
work.
This processor creates a new thread
and it sleeps for the time specified in
Sitecore.config file by the value of
/scheduling/frequency
Value of frequency determines the
interval at which the system checks
How does the Scheduler Runs
Sitecore Agents & Task
• Automate tasks to perform pre-defined activities.
• Mostly used by Sitecore to carry out the administrative work from there end.
• It is very similar to Scheduler when it comes to what kind of operation it can do. Major
difference between the two is about configuration.
• Configuring Agents – An agent is used to configure a scheduled task. The default agent
can be found in the Sitecore.config file. If we want to create a new agent, the best
practice is to do so through the Sitecore Patch File.
• Tasks – It is a method that is run by an Agent.
<agent type=“Fully Qualified Class Name” method=“Method Name To Run”
internal=“HH:MM:SS” />
Demo
Questions
Thx.

More Related Content

PDF
Ca 7 primer
PDF
Scheduling tasks the human way - Brad Wood - ITB2021
PDF
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
PPTX
Mule tcat server - automating tasks
PPTX
Project scheduler system by custom Soft
PPTX
Project scheduler system by customsoft
PDF
TYPO3 Scheduler
PPT
How to schedule_a_project_in_ms_project_2003
Ca 7 primer
Scheduling tasks the human way - Brad Wood - ITB2021
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
Mule tcat server - automating tasks
Project scheduler system by custom Soft
Project scheduler system by customsoft
TYPO3 Scheduler
How to schedule_a_project_in_ms_project_2003

Similar to Understanding Sitecore Schedulers: Configuration and Execution Guide (6)

PPTX
Diving into Sitecore Pipelines and Processors: Concepts, Customization, and B...
PPTX
Visão Geral do Schedule Manager
PPTX
Centralize Islands of Automation
PPSX
Components of a scheduling system rev 2015 slide show
PPTX
Scheduling of a project
PPTX
My Presentation @ LinkDev
Diving into Sitecore Pipelines and Processors: Concepts, Customization, and B...
Visão Geral do Schedule Manager
Centralize Islands of Automation
Components of a scheduling system rev 2015 slide show
Scheduling of a project
My Presentation @ LinkDev
Ad

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
KodekX | Application Modernization Development
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation theory and applications.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
KodekX | Application Modernization Development
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
Unlocking AI with Model Context Protocol (MCP)
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation theory and applications.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Weekly Chronicles - August'25 Week I
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Empathic Computing: Creating Shared Understanding
Ad

Understanding Sitecore Schedulers: Configuration and Execution Guide

  • 2. • What are Schedulers in Sitecore? • Overview of Schedulers • Scheduler Configuration • Flow and example of Scheduler • How does Scheduler Run? • What are Sitecore Agents? • Demo Agenda An investment in knowledge pays the best interest. – Benjamin Franklin
  • 3. Schedulers Overview • Automate tasks to perform pre-defined activities. • Provides you the flexibility to trigger an action when specific conditions are matched. • Allows you to perform routine task at a specific intervals. • Easy and straightforward approach to run code logic at specific intervals. • Examples of scheduler:  Send an Email at a specific interval based on the conditions.  Read a third-party URL and Create + Publish Items programmatically.  Go through all the extranet users that exist in Sitecore and perform some activity on their last login or send an email to stack holders if the users have updated the profile in the last week.  Periodically unlock the items that have been locked by different content authors.
  • 4. • We can configure scheduled tasks in the Sitecore under the following location /Sitecore/System/Tasks • Mainly there are two elements in Sitecore tree that needs to be configured for a scheduler configuration: 1. Schedules  This has the data on when a command needs to be called, at what time interval and has the data on when it’s Last Run. 2. Commands  Custom logic (code) that must be executed when the scheduler executes the TASK. Schedulers Overview
  • 5. There are three main steps that a developer will do to implement a scheduler in Sitecore. Step 1) Writing your code that will be executed when scheduler runs. Step 2) Create the command item and provide the type and method name. Step 3) Create the scheduler item and assign the command item created above and do its configuration. Schedulers Overview
  • 6. • Create your own class and write the code that needs to be executed when scheduler runs. • The method defined in this class will run within a specified interval and the code in this method will be executed every time. • Array of the items of type Sitecore.Data.Items.Item • Sitecore task CommandItem of type Sitecore.Tasks.CommandItem • Sitecore task ScheduleItem of type Sitecore.Tasks.ScheduleItem Commands Code File – Step 1
  • 7. • To call the method from a scheduler create a new command under the following node: /sitecore/system/Tasks/Commands • Type – Refers to your Namespace with Class Name and Assembly qualified type. (Project.Features.Items.Tasks.CreateAndP ublish,Project.Features.Items) • Method – The method name in your class to which the control will be passed. Commands Item In Sitecore – Step 2
  • 8. Scheduler Item In Sitecore – Step 3 • To call the new command create a new scheduler item under the following node: /sitecore/system/Tasks/Schedules Command: Select/Specify the command path. (Command created in earlier step) Items: This is where we declare the Sitecore items array if we wish to populate it in our class method. It can also be used to send parameters for your custom class logic. Schedule: Specify the time interval. i.e., how frequently the job should run. Last Run: Indicates the previous run date/time value. Async: By checking this box, the command will run asynchronously Auto remove: We can use this field to remove the schedule definition item automatically when the task expires.
  • 9. Schedule Field: The configuration setting for the field named ‘schedule’ uses a pipe separated string as given below, which determines when the task should be running: Start/End Timestamp Format – YYYYMMDD • If you want to start the scheduler after a specific date then you can mention the same in this timestamp and it will execute accordingly. • If you want to ensure that the scheduler should not execute after a specific date then you can mention the same in this timestamp and if you don’t have any specific end date then you can set it to maximum – 99990101 Scheduler Item Configuration {start timestamp} | {end timestamp} | {days to run bit pattern} |{interval}
  • 10. Days to run • It uses a 7-bit pattern that determines, the days when a task must run: 1 = Sunday 2 = Monday 4 = Tuesday 8 = Wednesday 16 = Thursday 32 = Friday 64 = Saturday • Days to run is the sum of the day number when the task must run. • To run the task on Saturday and Sunday, add the values, 1+64 = 65. • To run the task every day the number will be 127 i.e. sum of all the days (Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday) = (1+2+4+8+16+32+64) = 127 Interval • Interval = HH:MM:SS {start timestamp} | {end timestamp} | {days to run bit pattern} |{interval} Scheduler Item Configuration
  • 11. InitializeScheduler - Processor Initialize pipeline includes a processor Sitecore.Pipelines.Loader.InitializeSched uler If we remove this InitializeScheduler processor from the initialize pipeline then none of our scheduler / agent will work. This processor creates a new thread and it sleeps for the time specified in Sitecore.config file by the value of /scheduling/frequency Value of frequency determines the interval at which the system checks How does the Scheduler Runs
  • 12. Sitecore Agents & Task • Automate tasks to perform pre-defined activities. • Mostly used by Sitecore to carry out the administrative work from there end. • It is very similar to Scheduler when it comes to what kind of operation it can do. Major difference between the two is about configuration. • Configuring Agents – An agent is used to configure a scheduled task. The default agent can be found in the Sitecore.config file. If we want to create a new agent, the best practice is to do so through the Sitecore Patch File. • Tasks – It is a method that is run by an Agent. <agent type=“Fully Qualified Class Name” method=“Method Name To Run” internal=“HH:MM:SS” />
  • 13. Demo
  • 15. Thx.