Skip to main content
I'm trying to write a SOQL query to cycle through a recordset and retrieve a subset from another recordset.  Noob here.  I keep getting the message.

Line: 1, Column: 68

Didn't understand relationship 'Project_Time_Entry__c' 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.

This is what the query looks like and that's the correct object names.

List<Customer_Training__c> trnLst = new List<Customer_Training__c>([SELECT

                                         Id,

                                         Name,

                                         (SELECT Id, Name, Billable__c, Time_Spent__c

                                             FROM 

                                             Project_Time_Entry__c) 

                                         FROM Customer_Training__c LIMIT 200]);

Help?  I know it's something subtle.
3 answers
  1. Oct 2, 2015, 2:08 AM

    You need to give the relationship name. Please try this:

    List<Customer_Training__c> trnLst = new List<Customer_Training__c>([SELECT

    Id,

    Name,

    (SELECT Id, Name, Billable__c, Time_Spent__c

    FROM

    Project_Time_Entry__r)

    FROM Customer_Training__c LIMIT 200]);

    Thanks!
0/9000