3

The system overview tells me that the org contains a number of email messages. Using SOQL, I see that parentId is always empty. So I think that the email messages are orphaned. I cannot delete them, whatever method I use, I always get the message: "Insufficient Access Rights On Object Id".

How can I get rid of these things? Obviously I have sysadmin profile.

My Apex script that fails:

delete [SELECT id FROM EmailMessage];

Edit: I added some attributes to my query, to see which user sent which mails, and it turns out I can delete mails that I have sent, but not mails that others users have sent.

7
  • How are you trying to delete these records?
    – Preya
    Commented Oct 6, 2016 at 13:44
  • I have tried Apex, to delete a selection of email messages, as well as the option in Workbench to delete individual records, given an Id. Commented Oct 6, 2016 at 13:48
  • Please check the ID you have given to delete the record. You could also post the apex code to dig further
    – Preya
    Commented Oct 6, 2016 at 13:49
  • I have posted the code. The ids all start with 02s. The semi-official description of that is 'HTML_COMPONENT'. Commented Oct 6, 2016 at 14:11
  • 2
    I'm having this same issue. It is amazing how annoying Salesforce can be. I, as a System Admin, can't delete emails that are using more than 1/5 of my org's storage capacity. Commented Mar 7, 2017 at 19:24

1 Answer 1

2

The only solution I know of is to perform the delete operation when logged in as the user who sent the EmailMessage record.

This coincides with what Sander observed that he was able to delete emails he sent but not those sent from other users.

You must log in to answer this question.

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