I have a unit test that creates an Event (in the future) and some EventRelations (for Contacts, with isInvitee=True), and then later deletes 1 of the EventRelations, via runAs(SysAdmin). Pretty sure this was working a couple of weeks ago, but now the delete is failing:

System.DmlException: Delete failed. First exception on row 0 with id 0RE11000004qxLKGAY; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []

Events don't have explicit CRUD perms, but Sys Admin has full crud on the Contacts. What is controlling/causing this?

1 Answer 1


While tracking down a different unit test, I discovered that another trigger, which is updating the Events, is having the side effect of deleting the EventRelations. I don't know why, and that may end up being another question posted, but for now, I've confirmed that when the above error is occuring, the error message is a bit misleading- it's because the EventRelation Id in question has already been deleted.

You must log in to answer this question.

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