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
FletchFletch 

Help needed - cannot get SOQL query to return lookup to queried object

I'm hitting a problem where I am trying to do the following.
 
1) Querying a table of custom objects "Test_Case__c".
 
2) For each returned object, creating a new object that has a lookup to the Test Case object.
 
The WSDL for the "Test_Case__C" table does not appear to include any Id-type field that refers to the object itself.
 
What do I need to query/do to get the Id field I need for the lookup?
FletchFletch
Note that the "Name" field is a string for this object and will not work as a lookup (I've tried it).
PBS_IC786PBS_IC786
I believe this will require the use of merge fields.  The Id field for custom objects should be available through merge fields. 
FletchFletch

I have the answer from the salesforce tech support team:  every object, including custom objects, has an implicit "Id" column that can be queried using that reference string.  This column is not mentioned in the WSDL.

I've pointed out that this should be documented somewhere (neither I nor the tech support team could find supporting documentation for this part of the API).

My strong preference would be to have the "Id" column included in the WSDL, and I've asked salesforce to look at that possibility.

DevAngelDevAngel
The wsdl defines an explicit Id field.

Code:
<complexType name="sObject">

<sequence>
<element name="type" type="xsd:string"/>
<element name="fieldsToNull" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<element name="Id" type="tns:ID" nillable="true"/>
<any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</sequence>
</complexType>
</schema>
The describeSObject call also provides this information.  Not sure what it is that you are suggesting.