You need to sign in to do that
Don't have an account?
Calin Fintzi 13
Relatedtoid SOQL references
RelatedtoID on Email message and WhatID on Task both allow many different objects to be referenced. Is it possible to querty into the reference table of the object type that's in the field?
EX: If I know that the field contains a reference to a contract could I do the following:
SELECT Id, TextBody, MessageDate
FROM EmailMessage
WHERE RelatedTo.BalanceDue = 0 AND RelatedTo.Type = '#*@$'
EX: If I know that the field contains a reference to a contract could I do the following:
SELECT Id, TextBody, MessageDate
FROM EmailMessage
WHERE RelatedTo.BalanceDue = 0 AND RelatedTo.Type = '#*@$'
Can you provide more clarity on what you meant by "query into the reference table of the object type that's in the field" so I can suggest better? If possible, another SOQL example and what is the error you are seeing
Related: https://salesforce.stackexchange.com/questions/224298/different-between-relatedtoid-vs-parentid-in-emailmessage
https://salesforce.stackexchange.com/questions/143528/emailmessage-query-returns-no-such-column
Thanks