A polymorphic lookup is, by definition, one where the
SObjectTypeof 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.
CreatedByis 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?
Looks like before Spring 12,
CreatedBy field, on some objects, could be linked with
Found this 2010 blog post showing this screenshot:
SelfServiceUser is no longer available in new orgs as per doc here but since still active in older orgs, it remains polymorphic :
Represents a Contact who has been enabled to use your organization’s Self-Service portal, where he or she can obtain online support.
Starting with Spring 12, the Self-Service portal isn’t available for new orgs. Existing orgs continue to have access to the Self-Service portal.