soapsalesforcesoql

SOQL child to parent query works in developer console but not in soap call


I am working on a query to pull data from a salesforce object, and one column from a parent to that object using c# soap call with a salesforce generated wsdl

The query works fine in the SOQL developer console,and I have verified the relationship names but when I call it in c# via soap the error message returns

ERROR at Row:1:Column:59 Didn't understand relationship 'parent__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.'

The same soap call and c# returns a query result when I remove the relationship field from the SOQL. Here is the query i am trying to use with the parent and child object names replaced.

"select Name, parent__r.name,City__c,State__c,Zip_Code__c from Child__c" I have alsow tried " select name, ( Select parent__r.name from parent__c), ....from Child__C" and "select name,child__c.parent__r.name,... from child__C"


Solution

  • If a query works in one place but not another typically it means security issues. Is same user connecting over C# app and testing in the developer console?

    If you query a relationship (lookup, master-detail) typically you need at least "Read" right on the field (so parent__c) and "Read" on the target object.