function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Problem with deployment

Hi guys, I was trying to deploy an object called pallet__c. but i got an error in one of my test saying "No such column 'Id' on entity pallet__c". Does anybody have any idea why its giving me this error.

Best Answer chosen by Admin (Salesforce Developers) 




Its because “One of the field ” and many other Salesforce relations become “Polymorphic” if pointing to more than one type of object as parent. 

“A polymorphic key is an Id that can refer to more than one type of object as a parent. For example, either a contact or a lead may be the parent of a task. In other words, the WhoId field of a task may contain the Id of either a contact or a lead. If an object can have more than one type of object as a parent, the polymorphic key points to a Name object instead of a single object type.”

So, one can’t expect a single Sobject type fields for polymorphic relations/keys. Rather, check what fields are available in entity “Name”. That is why one can’t find User sobject’s fields like SmallPhotoURL and CompanyName on CreatedBy polymorphic relationships.

Note: Not all CreatedBy relationships are polymorphic it totally varies from sobject to sobject.