Tagged: Job

Automating Cleanup Tasks with Optimizely Scheduled Jobs

Scheduled jobs in Optimizely CMS are a powerful way to automate any background tasks like content cleanup, indexing, or reporting.

I created a simple scheduled job to delete the expired content.

Let’s get started.

Step 1: Create the Job Class

  • Created a job called ExpiredPagesCleanupJob.cs that inherits the ScheduledJobBase class.
  • Implement logger as needed, currently commented out in code.
  • Rebuild and deploy the solution.

Step 2: Run the job

  • Wondering, don’t I need to register the job in Optimizely CMS? No need, it automatically registers the job using the [ScheduledPlugin] attribute.

Optimizely-CMS-Scheduled-Job-1.png

  • Let’s navigate to Settings -> Scheduled Jobs
  • Now you will see the job listed and ready to be started.

Optimizely-CMS-Scheduled-Job-2.png

  • Let’s start the job manually for now.

Optimizely-CMS-Scheduled-Job-3.png

  • History shows whether the job has succeeded or not.

Optimizely-CMS-Scheduled-Job-4.png

  • Before running the job, the Expired Page report showed that two content pages had expired.

Optimizely-CMS-Scheduled-Job-5.png

  • Now let’s check the reporting results again. yay! It’s successfully deleted!

  • You can schedule the job every 5 seconds, minutes, hourly, and so on.

If you prefer watching a video, my quick recording –

Hope this helps.

Happy Optimizing!

0