0
votes

Occasionally Salesforce Object have polymorphic relationships with other Salesforce Objects. In a polymorphic relationship, the referenced object of the relationship can be one of several different types of object. These polymorphic relationships are defined using polymorphic fields contained in a Salesforce Object. A polymorphic field is one where the related object might be one of several different types of objects. For example, the Who relationship field of a Task Object can be a Contact or a Lead. Similarly the What relationship field of a Task can be any non-Person Object in Salesforce.

How do I find out the Object Type of a Object ID in Polymorphic field using the CData Salesforce Driver?

1

1 Answers

0
votes

Salesforce has "Polymorphic SOQL" for these. And looks like CDATA supports it.

SELECT Task.Subject, Contact.Name
FROM Task, Contact
WHERE Contact.Type='Contact'

SELECT Id, TYPEOF What 
        WHEN Account THEN Phone 
        WHEN Opportunity THEN Amount 
    END 
FROM Event