Big Idea or Enduring Question:
How do you automatically delete posts generated from quick actions?
A few months back, I had written an article Getting Started with Process Builder – Part 17 (Auto Delete System Generated Chatter Post) to discuss a way through which, we can auto-delete system generated Chatter posts. This article goes a step ahead and explains, how to auto-delete posts generated from Quick Actions for objects in which Feed Tracking is not enabled.
After reading this article, the reader will be able to:
- Using Process Builder to auto-delete system-generated chatter posts
- How to use get the delete element to delete records
- How to Launch a Flow from Process Builder
Business Use case
Rachel Gillett is working as a System administrator at Universal Containers (UC). At UC they have created a custom object called Time Sheet, to allow their sales reps to enter the time they spent at a customer site (i.e. against Account object). The Time Sheet object has a lookup relationship with the Account object, and Feed tracking is turned off for the Time Sheet object. Rachel has received a requirement from the management when sales reps create a Time Sheet from an account object using quick action, the system auto-generates a chatter post similar to the following screenshot:
Business wants to auto-delete posts generated from Quick Action.
Automation Champion Approach (I-do):
First of all, you have to understand the Feed object in Salesforce. All objects have a default related Feed object. All Feed objects for custom objects are named as CustomObject__Feed, where CustomObject__c is the name of the related custom object. All Feed objects for standard objects are named as LeadFeed, where Lead is the related standard object name.
But the glitch is Feed object is by default available (You can access it from the API or Flow) for a standard object, even though Feed Tracking is turned off, but that is not the case with the custom object. If Feed tracking is turned off for a custom object, then the CustomObject__Feed object will not be available. So you can’t use the CustomObject__Feed object to delete the posts (On parent object) generated from Quick Actions.
There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the business requirement.
Before discussing it, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.