I have a strange situation. A customer has a trigger on Event that sends an email to a given list of people when a new event is created. We recently enhanced this functionality and added the ability to resend the email.

One of the first lines in the email has the people invited to the event. The user creates an event with more than one related contact. In the trigger code we read from EvenWhoRelation to get the contacts that were associted to the event.

Here's the weird part, when the event is created in Lightning, everything works fine, all the attendees are retrieved.

When the event is created in Classic, only one attendee is retrieved from the same query. But, if you take the event created in Classic, switch to Lightning, and click our new resend button(uses the same code) all the attendees are retrieved.

In the sandbox I added debug statements around the query, and sure enough, in classic, only one record comes back, in lightning they're all returned...

I've looked and can't find any details on this online, can anyone point to why this is happening?

Edit: Tried following Daniels answer, but that bore no fruit.
I changed the following query:

SELECT RelationId, Type FROM EventWhoRelation WHERE EventId = :evt.Id AND (Type = 'Contact' OR Type = 'Lead')]


SELECT RelationId  FROM EventRelation WHERE IsParent = true AND IsWhat = false AND IsInvitee = true AND EventId = :evt.Id

And the result was events created in classic still only found 1 related invitee, and events created in Lightning now found none. So even if I tried to determine the UI of the user, and switch queries based on that, the Classic one still does not work as intended.

1 Answer 1


There is a known issue for another problem related to EventWhoRelation. So that object seems to be faulty. Try to query EventRelation instead, like this:

SELECT Id FROM EventRelation WHERE IsParent = true AND IsWhat = false
  • Thanks for the info on the known issue, but trying this out didn't work. I edited my question with the details.
    – DConroy
    Dec 7, 2020 at 14:37
  • Then I‘d create a case at Salesforce. Dec 8, 2020 at 11:48

You must log in to answer this question.

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