As an enterprise digital experience platform, Sitecore provides brands with the ability to easily manage content across its website and corporate intranet and create a seamless, personalized experience for consumers. Sitecore streamlines digital marketing operations for business growth and, with new updates, it continues to deliver improved customer experiences through personalization.
Sitecore is a difficult platform to learn and master and I’m very fortunate to work at DEG where myself and another have developed the skills needed to be recognized as Sitecore MVPs, which is why I’m sharing my knowledge with you today. I want to help others dive into this complex platform to leverage its ability to build incredible solutions for brands.
The benefits of scheduled tasks
One of the features within Sitecore is the ability to create a scheduled task for greater efficiency and better time management. Scheduling tasks within Sitecore allow you to schedule a task on a certain date and time, automating your business process while you focus on other tasks that require greater attention.
How to create Sitecore Scheduled Tasks
While you’d expect the steps for scheduling a task in Sitecore scheduled to have changed with platform upgrades, it’s actually very much the same as when we first gained the ability to schedule tasks.
The first step in scheduling a Sitecore task is to create the .NET class that contains the logic you want executed. Here’s an example of my logic for logging a message whenever the task is run.
To create your method, you must accept three arguments:
- An array of items you specify later when defining in the command’s schedule
- The Sitecore CommandItem task
- The Sitecore ScheduleItem task
Once you have defined your logic, you can create your Sitecore task command.
Go to the System/Tasks > Schedules folder and create a new scheduled task.
Next, you need to define your schedule.
- Select the command you created under the Command field.
- In the Items field, define the population of the items array in your class using a Sitecore query without the “query:” prefix or a pip “|” delimited list of items.
- Defining the Schedule can be trickier—you’ll notice my example shows several piped values. They are defined as:
- Start date in yyyyMMdd format.
- End date in yyyyMMdd format.
- Days of the week the task should run. Each day has the assigned value of 1 = Sunday, 2 = Monday, 4 = Tuesday, 8 = Wednesday, 16 = Thursday, 32 = Friday, and 64 = Saturday.
- To schedule a Monday-thru-Friday task, you would enter 62 (2 + 4 + 8 + 16 + 32).
- My task is set up to run every day: 1 + 2 + 4 + 8 + 16 + 32 + 64 = 127.
- Minimal interval for the task to run in HH:mm:ss format. My example is set to run once every 24 hours.
- Sitecore updates the last run field whenever your task is run. You don’t need to set this when creating your scheduled task. If you do set this, Sitecore will believe the date entered was the last time it invoked your command.
- Check the Async field if you want your task to run asynchronously.
- Check the Auto Remove field if you want Sitecore to automatically remove the schedule definition item after your task has expired.
Now, your task is set up and scheduled to run at your specified interval.
Creating a seamless Sitecore experience
Sitecore connects brands with their customers, providing end-to-end content management, always-on personalization, and connections that drive commerce. But starting any project can bring unforeseen challenges. That’s why partnering with a skilled Sitecore Solutions Partner can help you quickly realize your digital experience goals and start working toward achieving them.
DEG has ample experience helping brands of all shapes and sizes develop and optimize Sitecore solutions for their business needs. We also have the Sitecore accelerator Elision, which is designed to efficiently streamline the process of constructing sites with the latest best practices and technology.
Developing a comprehensive content strategy
One of the biggest business goals isn’t simply to build a new website or portal, but to improve engagement with your target audience—whether that be employees, clients, or customers. Without the right content management strategy, how can you properly provide the information needed for your audience to complete a task or purchase? The answer is, you can’t.
Maximizing your online content for the staff, client, or customer journey is vital for your success. We help brands audit their content before we begin developing a solution to ensure we know of all information and its purpose to architect a clear structure and navigation for your audience.
If you have any questions about scheduling a Sitecore task or creating a more optimized Sitecore solution, feel free to reach out. We’d be happy to discuss your business and content strategy goals with you.