Model condition based on polymorphic field

  • 1
  • Question
  • Updated 2 years ago
  • (Edited)
I want to be able to display EventRelation or Event records in a table on the Account record if the Relation.Id/RelationId or Who.Id/WhoId is equal to the Contact.Id/ContactId in the list of AccountContactRole records associated with the Account record.

So far I have tried a condition on Event object using Who.Id or WhoId, EventRelation object using Relation.Id or RelationId, and EventWhoRelation object using Relation.Id or RelationId.

Any condition that references the Relation.Id or RelationId on EventRelation or EventWhoRelation returns the same number of EventRelation or EventWhoRelation records  regardless of whether or not I have a condition applied.

Is it not possible to use the RelationId field from EventRelation or EventWhoRelation when querying? If not, is this a bug or purely a Salesforce quirk around polymorphic lookup fields? Or am I doing something very wrong?

Below is an example condition.

It may be worth mentioning that the RelationId field returns contact Ids.

And the model containing AccountContactRole records is queried on page load
Photo of Glenn Daly

Glenn Daly

  • 1,848 Points 1k badge 2x thumb
  • very....very..... confused

Posted 2 years ago

  • 1

Be the first to post a reply!