I would like to Delete casefeed whenever a email message is deleted. Current if I delete email message the mail record is getting deleted but still the case feed displaying in casefeed. (I Dont want to delete all the feeds Only perticular feeds need to be deleted.)

enter image description here

2 Answers 2


You could query FeedItem record based on Parent Id and delete that

delete ([SELECT Id FROM FeedItem
WHERE ParentId =: <your email record Id>]);
  • It will delete all case feeds right? May 31, 2019 at 6:48
  • yes, that should be May 31, 2019 at 6:49
  • But i need to delete only the deleted email feed? May 31, 2019 at 6:53
  • update my answer May 31, 2019 at 6:58
  • ParentId Refered to case and not with email does it really work? strange..! May 31, 2019 at 7:00

The issue is i deleted email message from trigger instead of this I called future method to delete emailmessage so feed also getting deleted

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .