Skip to main content
2 of 2
added info on Workbench
Jason Clark
  • 12.2k
  • 7
  • 64
  • 123

Unable to query deleted EventRelation records with ALL ROWS

The EventRelation object has an IsDeleted field, which implies that I should be able to query for deleted records. However, I'm not seeing that. After manually removing an invited contact from an Event, I cannot find the deleted record.

This is the POC code I'm using in a scratch org with just a handful of events & EventRelations, so that I can query all records without a where clause (to eliminate one possible point of failure). I have the System Administrator profile in the scratch org, and I own all of the involved records.

List<EventRelation> res = [
    SELECT id, EventId, RelationId, IsDeleted, LastModifiedDate
      FROM EventRelation
       ALL ROWS
];
system.debug(res.size());
system.debug(JSON.serialize(res));

I never get any records with IsDeleted=true, and the size of my query result decreases each time I remove an invitee.

I'm not looking to undelete, just trying to identify people removed from meetings. As EventRelation doesn't support triggers, I cannot run code upon deletion. How to I query these deleted records?

Update: I also tried running the query from Workbench with the "include deleted & archived records" option, just to see if a different API would get different results, but I'm still not able to see an EventRelation I deleted only seconds before.

Jason Clark
  • 12.2k
  • 7
  • 64
  • 123