+ Start a Discussion
Frances AllenFrances Allen 

Uncheck Checkbox when Related Record is Deleted - Process Builder

I'd like to preface this post saying that I do not have access to create triggers in my Org currently. I'm automating this process entirely through Process Builder. 

The problem: 
I've created a process that checks a box on contact records after a record for another object is created. I'll refer to this object as 'availability'.  After a record for availbility is created, the checkbox located on a contact record is checked. It's that simple. However, I want to validate when there are no more availability records ( no availability records exist ) and uncheck that box when someone has erased their last availability record. 

The question:
What formula could I use to check if the boolean on contacts is checked, validate that there are no more availability records, and then uncheck the box? 

Any solutions or ideas would be appreciated.
Alain CabonAlain Cabon

The big problem with process builder and flows is that they cannot be triggered on deletions and un-deletions.

You cannot unckeck the checkbox during a deletion of the last availability records because the deletion itself cannot call a flow (only a creation or an update can trigger it).

The workarounds are:

1) Totally preventing the deletion of availability records from the screens and replace it with an update of an active/inactive flag (new field).
Regularly, you can delete the inactive records with a process/flow scheduled daily  https://douglascayers.com/2017/12/25/mass-action-scheduler/

2) Without an active/inactive flag on availability record (nor new roll-up summary field), you can just schedule a process hourly at best:   https://douglascayers.com/2017/12/25/mass-action-scheduler/   for the updates of the boolean on contacts with a process/flow.
You delete the last availability record at 10h01 and the process will be triggered automatically at 11h00 for unchecking the flag on contacts (not a great solution but can be sufficient for daily reports).

3) The other common technique: Create a roll-up summary field used to trigger an update event for a workflow or process   https://wdcigroup.net/triggering-salesforce-workflowprocess-builder-when-record-is-deleted/
The main problem with this very common technique is the strong contraints for the roll-up summary field (limited number).

Idea (missing feature): Workflow, Visual Workflow, and Process Builder should be able to be triggered on delete. (1200 votes, 3 years ago): https://success.salesforce.com/ideaView?id=08730000000DlPBAA0