A polymorphic lookup is, by definition, one where the
SObjectType of the parent be multiple different values. That was the basis for how I compiled Polymorphic keys - definitive list?
However, a colleague stumbled across another "polymorphic" relationship via other means, namely a SOQL compile fail. Here's the query:
SELECT CreatedBy.UserType FROM CaseFeed WHERE ...
And the error:
No such column 'UserType' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
That error seems to clearly indicate this lookup is polymorphic.
Looking at the above data points, I was pretty shocked.
CreatedBy is always a
User, everywhere in the system. Just to sanity check, I ran the below script:
The log output was as expected:
One line of investigation clearly indicates this field is not polymorphic. The other seems to indicate it is polymorphic. I'm strongly inclined to believe the former. Is there a platform bug or Known Issue here? Or is it expected behavior?