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


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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.