I have created a process builder 'CaseFeedDeleteProcess'.
It is like whenever a case is created/edited and the criteria is 'Case Status is Changed to true', then launch the flow named 'CaseFeedDeleteFlow'.
While launching the flow, I am setting the flowvariable with caseid as shown in screenshot.
My flow will contain only the RecordDelete element for deleting the casestatuschange feeds.
ChangeStatusPost is a variable which has the value as 'ChangeStatusPost'. This is one of the values of Type field on CaseFeed object. All statuschangefeeds will have the Type as ChangeStatusPost. So my flow will delete only those feeds which has the status change feeds.
Issue: When user modifies the record, all status change feeds are getting deleted on the case record but the problem is when user again changes the case status to something else, I am getting the flow error emails saying
Failed to delete records that meet the filter criteria. Error: There are no records in Salesforce that matches your delete criterion.
How to escape this exception? There should be some condition on my flow that if there is no case feed present on the case then only it should fire the flow. Please help me. Also, let me know if it possible to build directly the process builder on FeedItem object without impacting the performance on case edit.