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
chandu504231chandu504231 

SOQL Polymorphisim for custom objects

Hi All,

      Can we use SOQL Polymorphisim for only custom objects with out using standard objects
Sonam_SFDCSonam_SFDC
Hi Chandu,

When I read the following doc related to SOQL Polymorphism  - It reads that its not specific to standard objects as such but did you try using this on a custom object?
http://www.salesforce.com/us/developer/docs/soql_sosl/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm#relates_and_polymorph_keys

Please explain your use case a bit so we can understand the requirement of such feature better..
chandu504231chandu504231
Thank you for your response

 I tried soql polymorphism with three custom objects  are Ccontact__c,Clead__c,Ctask__c.either a Ccontact__C or a Clead can be the parenet of a Ctask__c.in that which field take as a polymorhic key?
in standard object have same raleationship we are use Whoid field as polymorphic key.


Sonam_SFDCSonam_SFDC
Hi,

As such, the polymorphic keys cannot be created for custom objects - in your case - Ctask__c behavior is polymorphic but how are you crating this field to lookup to two separate objects Contact and lead?