Find your content:

Search form

You are here

Is the OwnerId field in the Report object a polymorphic key or not?


Is the OwnerId field in the Report object a polymorphic key or not?

So the OwnerId field in the Report object can be either a reference to a Folder, Account, or User, doesn't this make it a polymorphic key? And if so, why doesn't this work?

SELECT Name, Description, OwnerId.Name FROM Report WHERE OwnerId.Type = 'Report'

This is the doc I'm referring to for polymorphic keys:

Attribution to: fourq

Possible Suggestion/Solution #1

The OwnerId is not a polymorphic key here.

The query wont work and we cannot apply that query .Also found that the ownerId is not a foreign key.

Consider the screenshot below of Report Object in eclipse enter image description here

We see above that OwnerId is not foreign key also only filterable and its not updadtable or creatable

Consider same from Event Object

enter image description here

The foreign key is who and its creatable and updatable as well hence can be used in Polymorphic queries and also can be filtered on TYPE.

Attribution to: Mohith Shrivastava

Possible Suggestion/Solution #2

A couple things. First if you're reference fields on a parent object you'll want to use the relationship name.

SELECT FROM Report WHERE Owner.Type = 'Report'

Second, based on the report docs the owner field on a report refers only to user who created the report.

Third, Owner is a Name object, which is polymorphic. For a list of fields you can reference for any name object see the Name docs.

Attribution to: Ralph Callaway
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content