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
protoguyprotoguy 

Relationship Queries with the Partner WSDL

Hi--
 
I'm experimenting with relationship queries using the partner wsdl.  The docs say:
 
"The partner WSDL does not contain the detailed type information available in the enterprise WSDL to get the information you need for a relationship query. You must first execute a describeSObjects call, and from the results, gather the information you need to create your relationship query:
  • The relationshipName value for one-to-many relationships, for example, in an account object, the relationship name for the asset child is Assets.
  • Use the reference fields available for the relevant object, for example, whoId, whatId, or ownerId on a lead, case, or custom object."

I can't make this into sense.  Let's make things specific so they are easier to follow.  Say I want to run one of the example queries relating accounts and contacts from the docs.  describeSObject on Account gives me a childRelationship[] that shows me that I've got one relating AccountId and Contact called "Contacts".  I confess that I don't follow what the second bullet is saying.  So how do I build this up into a query?  Where do I put my relationshipName?  It doesn't seem to be included in any of the examples. 

An example in the docs:

SELECT Id, FirstName, LastName, AccountId, Account.Name FROM Contact WHERE Account.Name LIKE ’Acme%’

I can't run this query, because I get a MALFORMED_SQL error about not being able to query relationships.

That note at the end of the doc page quote above makes me think that I can, if only I could build up the

query correctly. Any advice?

Message Edited by DevAngel on 01-10-2007 10:03 AM

SuperfellSuperfell
There's some simple samples of aggregate queries on the blog
http://blog.sforce.com/sforce/2007/01/soql_relationsh.html

As for the error, you can only run SOQL relationship queries on the 8.0 API.
forceAMPforceAMP

If you download the QueryAmp beta at www.queryamp.com , you can use it to better understand the new 7.0 relationships.  QueryAmp has a graphical SOQL builder and will let you view the relationship metadata as well as the resulting SOQL statement.

QueryAmp is currently in a free-to-use beta period but will eventually be fee-based.

Bill

forceAmp.com