+ Start a Discussion
Rob P12Rob P12 

What's wrong with this query, I'm trying to reference Child relationship data

 I am trying to get to the Child Relationship Data.
 
In SF Explorer:
   QMB_Cost_Center__c
     Child Relationships:
       R00n0000001OrWrEAK
          Child Fields:
             Budget_Actual__c
          Child Object: QMB_Budget__c
          Related Field: QMB_Cost_Center__c
          Relationship Name: R00n0000001OrWrEAK
trigger getBudgetData on QMB_Cost_Center__c (before insert) {
  For (QMB_Cost_Center__c cc : [Select id, name, (Select Budget_Actual__c from        R00n60000001OrWrEAK)
      from QMB_Cost_Center__c]){
  }
}
Error: Compile Error: Didn't understand relationship 'R00n60000001OrWrEAK' 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. at line 2 column 32
Tried:
     R00N0000001OrWrEAK__c
     R00N0000001OrWrEAK__r
     QMB_Budget__c
     QMB_Budget__r
jpizzalajpizzala
What is 'R00n0000001OrWrEAK' (or is it 'R00n60000001OrWrEAK' or 'R00N0000001OrWrEAK'?; note that SF ID fields are case sensitive, also the middle ID has a '6' whereas the other two do not)? Is this a literal object name? It looks like it is probably a SF ID. If this is the case, you can not perform a query on the ID directly, you will have to use something like the following:

Code:
select Budget_Actual__c from foo__c where id = 'R00n60000001OrWrEAK'
HTH