
Anonymous
Not applicable
2015-03-18
05:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Salesforce Relationship SOQL Query not returning related fields
I'm trying to run a manual SOQL query in a simple job with these components: tSalesforceInput --> tLogRow
The query:
SELECT Name, BillingStreet, Owner.Name, (SELECT Name, Phone,MobilePhone FROM Contacts WHERE Primary__c=true) FROM Account WHERE Status__c = 'Active Customer'
The background:
I can run this query in Salesforce's Workbench and it returns records with values in each field. In tSalesforceInput I've defined my schema as (all strings):
Name
BillingStreet
Owner_Name
Contacts_Name
Contacts_Phone
Contacts_MobilePhone
The problem:
I get all the expected records back, however no values are visible in the Contacts_Name, Contacts_Phone and Contacts_MobilePhone fields. The first three fields are populated as expected.
Does anyone know how to return values in a relationship query like this one? I suspect that the field name in the schema is important, but I haven't been able to figure it out.
Thanks in advance for any help!
Mike
The query:
SELECT Name, BillingStreet, Owner.Name, (SELECT Name, Phone,MobilePhone FROM Contacts WHERE Primary__c=true) FROM Account WHERE Status__c = 'Active Customer'
The background:
I can run this query in Salesforce's Workbench and it returns records with values in each field. In tSalesforceInput I've defined my schema as (all strings):
Name
BillingStreet
Owner_Name
Contacts_Name
Contacts_Phone
Contacts_MobilePhone
The problem:
I get all the expected records back, however no values are visible in the Contacts_Name, Contacts_Phone and Contacts_MobilePhone fields. The first three fields are populated as expected.
Does anyone know how to return values in a relationship query like this one? I suspect that the field name in the schema is important, but I haven't been able to figure it out.
Thanks in advance for any help!
Mike
370 Views
3 Replies

Anonymous
Not applicable
2015-03-25
05:07 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Have you tried to add the '__c' on the column name on schema. Note that the filed name is case-sensitive.
Best regards
Sabrina
Have you tried to add the '__c' on the column name on schema. Note that the filed name is case-sensitive.
Best regards
Sabrina
370 Views

Anonymous
Not applicable
2015-03-25
10:01 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this case all the fields are native Salesforce so there is no need for the __c. I did try every variant I could think of for the field names in the schema since I know they have to be formatted correctly. In the example I listed Owner_Name the Parent query field (Owner.Name = Owner_Name) works fine but I haven't been able to crack the code on the child query fields. Any help appreciated.
370 Views

Specialist III
2015-10-08
11:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Agreed, this does not work with Parent-to-child queries like this. I have also tried all combinations.
If you change the query to Child-to-parent, then it works with the "parent_" prefix for your schema. But doing it that way will NOT get you those parents that do not have any children. The only way to get that, is with the parent-to-child query like the one shown.
Or, to make multiple passes and tJoin/tMap.
If you change the query to Child-to-parent, then it works with the "parent_" prefix for your schema. But doing it that way will NOT get you those parents that do not have any children. The only way to get that, is with the parent-to-child query like the one shown.
Or, to make multiple passes and tJoin/tMap.
370 Views
