質問

I'm attempting to build an application using the Salesforce API (with custom PatronManager objects) and when I run the following "parent-to-child" query I get an error message stating that the relationship is not understood:

SELECT Name, (SELECT PatronTicket__InstanceDate__c FROM PatronTicket__EventInstance__r) FROM PatronTicket__TicketableEvent__c

However, when I reverse this and run a "child-to-parent" query, it works perfectly:

SELECT PatronTicket__InstanceDate__c, PatronTicket__TicketableEvent__r.Name FROM PatronTicket__EventInstance__c

Can anyone shed any light on why the parent-to-child query is giving me an error message?

Thanks!

Scott

Additional Info

I'm using the PHP Toolkit with the Enterprise WSDL and I'm getting the following error message:

Fatal error: Uncaught SoapFault exception: [sf:INVALID_TYPE] INVALID_TYPE: PatronTicket__InstanceDate__c FROM PatronTicket__EventInstance__r) ^ ERROR at Row:1:Column:57 Didn't understand relationship 'PatronTicket__EventInstance__r' in FROM part of query call. 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. in /home/scott/public_html/salesforce-test/salesforce/soapclient/SforceBaseClient.php:782 Stack trace: #0 [internal function]: SoapClient->__call('query', Array) #1 /home/scott/public_html/salesforce-test/salesforce/soapclient/SforceBaseClient.php(782): SoapClient->query(Array) #2 /home/scott/public_html/salesforce-test/aupac-enterprise.php(16): SforceBaseClient->query('SELECT Name, (S...') #3 {main} thrown in /home/scott/public_html/salesforce-test/salesforce/soapclient/SforceBaseClient.php on line 782
役に立ちましたか?

解決

This is Michelle from Patron Technology. Can you contact our client services department directly? Use the "support" link in the PatronManager CRM Help tab. It's awesome that you're trying to do this and I'd love to discuss it further.

I have a simple "for now" answer for you (you need to use PatronTicket_EventInstances_r plural, instead of Instance), but I also want to talk about this in more detail because technically the Salesforce API doesn't fully support accessing custom objects (and therefore our custom objects don't necessarily fully work with the API)...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top