Here is the information from chapter Registering Tasks in Sitecore Database from a book Professional Sitecore Development written by John West:

In addition to agents defined in the Web.config file, you can create task definition items in a Sitecore database. Ironically, Sitecore uses the DatabaseAgent and TaskDatabaseAgent agents defined in the Web.config file to invoke tasks defined in a Sitecore database. The difference between these two agents is that you must specify the database using the first element of the DatabaseAgent /configuration/sitecore/scheduling/agent element in the Web.config file, whereas the TaskDatabaseAgent determines the database from the first element within the /configuration/sitecore/TaskDatabase element in the Web.config file. The default Sitecore configuration invokes tasks defined in the Master and Core databases.

I understood the out-of-the-box way of using DatabaseAgent (by creating .NET logic, command item and schedule item in content editor) from this link: https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/repost-all-about-sitecore-scheduling-agents-and-tasks

Could someone please explain to me how to use the TaskDatabaseAgent out-of-the-box way (e.g. which out-of-the-box action that helps to insert record(s) into Tasks table in Core DB)?


2 Answers 2



The TaskDatabaseAgent gets tasks to execute from task database which is defined in Sitecore.config file like this:

<TaskDatabase type="Sitecore.Data.$(database).$(database)TaskDatabase, Sitecore.Kernel">
  <param connectionStringName="core" />

So by default it is core database. The agent gets pending tasks to execute from dbo.Tasks table in database.

Sitecore out of the box define three types of tasks for this agent. Those are EmailRemainderTask, ArchiveItem and ArchiveVersion.

Content editor users can create those tasks by using Schedule chunk on Review tab: Schedule chung under Review tab

Those tasks are saved on context item under Tasks section: Tasks section

And stored in dbo.Tasks table by OnItemSaving method of ItemEventHandler:

<event name="item:saving">
  <handler type="Sitecore.Tasks.ItemEventHandler, Sitecore.Kernel" method="OnItemSaving" />

So you rather don't want to use TaskDatabaseAgent but DatabaseAgent instead.


On the other hand we have two DatabaseAgent defined out of the box in sitecore. One for core and one for master database. Those agents execute tasks that are defined udner /sitecore/system/tasks/schedules path in sitecore.

Custom Agent

You can also create custom agent and define it in config file. I wrote more about it here


I believe that you are reading too far into John's details.

If you have a task that you need to run on some schedule, you can create a Sitecore Task Command item, which contains the Type to your custom code that you want to execute.

Then you create a Sitecore Task Schedule that will run that Command on a schedule.

You do all of that through the Sitecore UI. By doing so, if it's a task that is in the Master database, the Master_Database_Agent will pick it up and run your task.

The Agent is configured to run on an interval in the Sitecore configuration, and you can view any jobs running by watching the /sitecore/admin/jobs.aspx admin page.

There are a couple good blogs that I can point you to:

Basically, there are two Database Agents:

  • Master Database Agent
  • Core Database Agent

Each agent runs any of the Schedule Items found in the /sitecore/system/Tasks node on the respective database (master or core) based on their schedule and last run date/time.

  • Thanks for the information above. For TaskDatabaseAgent, the document mentions: ...whereas the TaskDatabaseAgent determines the database from the first element within the /configuration/sitecore/TaskDatabase element in the Web.config file.... If we look at the config file, there is: <TaskDatabase type="Sitecore.Data.$(database).$(database)TaskDatabase, Sitecore.Kernel"> Could you also please explain to me about this $(database)TaskDatabase (e.g. SQLServerTaskDatabase)? how do we insert records into Tasks table out-of-the-box way?
    – xdrnc
    Jan 12, 2018 at 9:13
  • You don't insert records into the database the way you are thinking. The $(database) is a variable that is replaced with "master" or "core". The out of the box method you are asking about is using the Command and Schedule Task Items in the Master or Core databases. Jan 12, 2018 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.