Declarative Scheduler Tool

Credit – I need to give ample credit and then some more to Doug Ayers. The original version was inspired by some of his work and then in version 2 it is literally copied off his work. His schedule adding campaign members is built into the tool

Sample user cases

  • A report of all leads over 4 days that have been stuck on a status for 4 days
  • Create a task to follow up on all opportunities that have a closed date in the past and no follow up tasks and haven’t been modified in the last 7 days
  • Send an email on a contacts birthday
  • Process mass updates to all data (create a workflow to fire when the triggering field change and then to do the function you want)
  • Delay bulk workflow actions into a nightly job
  • Backdate workflow processing – when you created a workflow/process build you can trigger it to run on all of the existing records 🙂
  • Let me know yours…

Notes: – It works off batch apex so you can change the batch size on each record. This stops any soql 101 or timeout process builder/flow errors – Has been tested to work on reports of up to 50,000 records. It’s built to be generic so works across all obejects – but you should add in your own datetime field.

Instructions

 

  1. Set up a report 
    1. Include an ID field of the record to update
    2. Include a datetime field that can be changed by the tool
    3. Add in report filters to limit the number of records to update
  2. Add a “Scheduled Report” record
    1. Select the record type “Update Field on Records”
    2. Select the frequency of the update. This tool will run every hour and detects if any “Scheduled Report” records are due to be updated.
    3. Look up the report in the drop down boxes at the bottom. Select the Id and datetime fields
    4. Click save –
    5. WARNING: saving the report selection schedules the tool to fire in one minutes time. If your record meets the condition then it will fire straight away. Make sure no other records are going to be scheduled at the same time.
  3. Set up a process builder to fire when the datetime field is changed:

Right click on the image to save it to your computer.

Installation

Managed Package

View the code on GitHub

 

Troubleshooting steps

  • Check the scheduled report logs for error messages
  • Reduce the batch size
  • Try and manually change the datetime field – might by another validation rule or flow in place causing problems
  • Leave an issue on the github page

Declarative Scheduler Tool for Salesforce admins – use the reporting engine and subscribe feature to update records in report on a daily/weekly/monthly schedule

  • Create a report with the record id in column 1 and a datetime field in column 2
  • Add the filters you like
  • Click subscribe. Then select a custom action. Then Declarative Scheduler (make sure to turn off the salesforce1 notification
  • Set up when you would like these records to update and then schedule away
  • On the scheduled time the datetime field will be updated. So set up a process builder to fire when that field changes. And voilla you have a repeating schedule.

Sample user cases

  • A report of all leads over 4 days that have been stuck on a status for 4 days
  • Create a task to follow up on all opportunities that have a closed date in the past and no follow up tasks and haven’t been modified in the last 7 days
  • Send an email on a contacts birthday
  • Process mass updates to all data (create a workflow to fire when the triggering field change and then to do the function you want)
  • Delay bulk workflow actions into a nightly job
  • Backdate workflow processing – when you created a workflow/process build you can trigger it to run on all of the existing records 🙂
  • Let me know yours…

Notes: – It works off super batch apex so you can change the batch size in custom settings. This stops any soql 101 or timeout process builder/flow errors – Has been tested to work on reports of up to 50,000 records. Don’t go larger of Salesforce CPU times out – It’s built to be generic so works across all obejects – but you should add in your own datetime field.
Todo: – Proper test classes – Instructions – Testing – Guidelines and examples

Instructions

Install the package below.
Right click on the image to save it to your computer.

Right click on the image to save it to your computer.

Right click on the image to save it to your computer.

 

View the code and download the package at GitHub

Share this post



4 thoughts on “Declarative Scheduler Tool

  1. Hello,
    Is there away to install the package in a Sandbox? We currently have Version 1.1 installed and would like to test the new version and see how it impacts current schedules.

    • Hi Karleen, yes you can install any package in Sandbox. That’s exactly what they are for. The version two still contains the schedule engine in version 1 it just has an additional engine and interface to make it easier to deal with multiple schedules and more frequently. The only known drawback is that it can only run reports up to 5k records and not 50k like the first version. This is a work in progress as hopefully once that is fixed there will be no limit.

  2. Hi there,

    This is a great tool! The only issue we have found is using it on large reports. The log is not generating any issue to go off, but the timedate field is only getting updated on about half the items on the report. Is there some way to get it to work on large (1000 – 2000 items) reports?

    Cheers!

    • It works on reports up to 10,000 records. I suspect a validation rule or flow error is causing a problem. Firstly, change and change the datetime manually and see if it works. If you don’t hit a problem there then try and reduce the batch size down to 1 and try again.

Leave a Reply to GravityLab Cancel reply

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