function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WhyserWhyser 

Can you delete the object that triggered the Flow?

I have a scenario in which a department wants to leverage email-to-case functionality to trigger the creation of a custom object.

The plan is simply
Send Email -> Email forward to Email-To-Case Servicing Address -> Email-To-Case creates a Case -> Case triggers a Flow that will create custom object.

During the course of the Flow, after the custom object is created, I wanted the Flow to DELETE the trigger case that was created from Email-to-Case.

However, whenever I add a Delete Record element to the Flow after the Custom Object is created, the Flow runs into an error: ENTITY_DELETED.

How would I go about deleting the triggering Case that instantiated the Flow automatically?
Best Answer chosen by Whyser
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Whyser,

You mean the Case record is not getting deleted? I hope the record is getting deleted but you are seeing the issue.

Can you add a  scheduled path and delete the case record after 1 minute in schedueld path hence the issue might get resolved.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,  

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Whyser,

You mean the Case record is not getting deleted? I hope the record is getting deleted but you are seeing the issue.

Can you add a  scheduled path and delete the case record after 1 minute in schedueld path hence the issue might get resolved.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,  
This was selected as the best answer
WhyserWhyser
I didn't think about, or even know, that we can branch off a Scheduled Path from the Start to have a time-delay as you suggested.

I created the delay for 1 minute and made a decision box to determine whether this is the proper kind of Case to delete before taking the action, Checked for the Case Origin and the Case Owner (Queue) specifically for this kind of Case.

Worked perfectly. Case deleted after one minute during tests.

Thank you!