+ Start a Discussion
etoeto 

bug in Sandbox API? SOQL: referenced contact/account objects are always null

When I create a SOQL String like the following, I found a different behaviour for sandbox and live environment:

Select ReferencedContact__c, ReferencedContact__r.Name from SomeObject__c

In the live environment everything works as expected, as I do have access to the referenced contact object and its Name, but when accessing Sandbox, the contact object (and of course the Name field) is always null. (Of course the Contact was added in SF).

This happens for at least references to Account and Contact objects. For references to user objects and custom objects I confirmed, that I do get an object (not null).

I first only tried with Adobe Flex but this can be reproduced in Apex Explorer too, so this seems not to bee an issue with Adobe Flex, but a general problem.

Or maybe I just did something wrong?

regards
Ingo


werewolfwerewolf
Do you actually have any Contact objects in Sandbox?  If you don't have any of those then of course there will be no references to any.
etoeto
yes, there are contacts. (see original posting "Of course the Contact was added in SF")

the request "Select ReferencedContact__c, ReferencedContact__r.Name from SomeObject__c"  returns an ID for ReferencedContact__c, but null for ReferencedContact__r.Name in the Sandbox, while it returns an ID and a String in Live environment.

when looking at the SOAP result, the ReferencedContact__r is simply empty or NIL and not a serialized object as it is in live environment.

Soap-Response Sandbox:
<sf:Buyer__c>003S0000002IJnvIAG</sf:Buyer__c>
<sf:Buyer__r xsi:nil="true"/>


Soap-Response Live:
<sf:Buyer__c>0037000000SraspAAB</sf:Buyer__c>
<sf:Buyer__r xsi:type="sf:sObject">
  <sf:type>Contact</sf:type>
  <sf:Id xsi:nil="true"/>
  <sf:Name>Jack Rogers</sf:Name>
</sf:Buyer__r>

SuperfellSuperfell
This is most likely to be that the user running the query on sandbox does not have sharing access to the 003S0000002IJnvIAG record.
etoeto
That's it.

I checked the settings and this user did not have access rights to contacts, while it had them in live environment.

I should have checked that before, but it didn't come to my mind. Sorry for that.

Thanks a lot.