I have a custom object called Invoice
that allows for Tasks/Events to be created for it. Using the SOQL query below, I am able to query on the Invoice
objects standard Name
field.
SELECT What.Name FROM Task WHERE Id = 'xxxxxxxxxxxxxxx'
My problem is such that, when I modify the statement to query on a custom field on the parent Invoice
object, I receive an error. Why is this?
SELECT What.Name__c FROM Task WHERE Id = 'xxxxxxxxxxxxxxx'
No such column 'Name__c' on entity 'Name'.
I'm guessing that this is querying on the Name
field instead of the sObject, but I've tried every permutation I can think of -- WhatId.Name__c
, What__r.Name__c
, What.Id.Name__c
, etc. -- and receive similar errors.
Please help.