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 🙂
  • Trigger a contract to renew on a certain date or create a new opportunity
  • 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 (sandbox)

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