Inspired by Marie Chandra’s idea Ability to schedule when process builder triggers, I developed a declarative way to schedule process builder to run at arbitrary times.
The most common use case for Process Builder is as a workflow tool to do things whenever some record, say an Account or Contact, is created or updated. But what if you had a use case where you wanted to create new records once a month? Or you wanted to call a Flow every day at 10am? How would you schedule that in Process Builder and not make it dependent on some other record like an Account or Contact being created or updated but rather occur on a predictable schedule? Introducing Process Builder Scheduler!
It is true that Process Builder cannot simply be invoked without the context of a record being created or updated. However, we can control the object that a process monitors and when those records get updated.
In this solution, I created a simple custom object Process_Builder_Schedule__c that captures a process’ API name and a cron expression indicating the schedule of when the process should run. When the record is activated by checking the Active__c field, an apex job is scheduled to periodically update that record by incrementing its Times_Triggered__c field +1. When the record is updated on that schedule then Process Builder runs and performs whatever actions you setup. Voila!
The trick is that these arbitrarily run processes don’t need to be contextually aware of a specific Account or Contact record being created or updated, they simply need to run on a predictable schedule. Therefore, as the administrator you create processes to run when records of this Process Builder Schedule object type are updated. In your process part of the criteria you setup checks if the record’s Process_API_Name__c field matches the value you’re looking for, and if so then you perform your actions, else you ignore it.
The unmanaged package comes bundled with an example process named Auto Post to Chatter that shows you how to setup the criteria node in your processes. Please read full instructions, screen shots, and installation links of the unmanaged package on my github repository: https://github.com/DouglasCAyers/sfdc-process-builder-scheduler.
I’m interested to hear your all’s ideas on better ways this can be achieved or other features you’d like to see in such a tool like this.