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
TesterInSkyTesterInSky 

How to query to get Owner or CreatedBy information

I try to query by using both Partner or Enterprise WSDL to get information of a particular SObject on Owner or CreatedBy, but got a 'invalid query' exception.

Would you tell me how to get such information
RickyGRickyG
Tester -

In order to understand why the query is invalid, it would help to see the query and get a bit more explanation.
TesterInSkyTesterInSky
yes, thanks for your reminding.

I do the query by using the following query strings:

select Id, OwnerId, a.Owner from Account a

or

select Id, Owner from Account a

in order to get the Owner information which is a nested SOjbect which I see in Enterprise WSDL.

But I got the following error message:

INVALID_FIELD:
select Id, Owner from Account a
^
ERROR at Row:1:Column:12
No such column 'Owner' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
SuperfellSuperfell
You have to select some fields from the related record, see the samples in the SOQL-R docs in the api docs.
TesterInSkyTesterInSky
yes, you are right, thank you.