Reply
Visitor
Seth@Scribe
Posts: 1
0

Unable to query fields associated to a Polymorphic Key

[ Edited ]

Are only the 'Name' object fields available when querying a relationship with a polymorphic key?

For example I can query the fields associate with the Name object from the Task object.

 

SELECT Id, AccountId, What.Id, What.Name FROM Task

 

However I retrieve an error: "No such column on entity 'Name'." when performing the following query which attempts to retrieve fields related to the specific object.

 

SELECT Id, AccountId, What.Id, What.Name, What.Amount FROM Task

 

I also attempted to query the Opportunity object directly which resulted in a different error: "Didn't understand relationship 'Opportunity' in field path."

 

SELECT Id, AccountId, What.Id, What.Name, Opportunity.Amount FROM Task

Are the 'Name' object fields the only fields available for this type of relationship?

 

Is it possible to query Opportunity, Campaign or Case specific fields from the Task object?

 

 

Note: This is using the query call through the SOAP API not the BULK API.

 

Moderator
SimonF
Posts: 7,980
0

Re: Unable to query fields associated to a Polymorphic Key

Yes, for polymorphic relationships you can only access properties on the name sobject.

Cheers
Simon
docs | blog | twitter