• Ravi Parameswaran
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,
I am new to sales force development. I have question on the SOQL query and using it in the list. If it has the child reference need to check to make some actions.it is throwing the error "Invalid field Asset_Options__r for Customer_Asset__c". I am sending herewith the code snippet. Any pointers in this regards is highly appreciated.

Regards,
Ravi

code snippet
==========
1) The SOQL query is something like this [ soql = select Id, Last_Maintenance_Date__c, (select Id, Value__c from Asset_Options__r where (Name = 'SOMETST')) from Customer_Asset__c  limit 1]
  
2) Building the list
    list<Customer_Asset__c> asset = database.query(soql);      

3) Action for the child objects
   for(sobject ca : asset) {
     ...
    ....
    sobject ao;
    system.debug(ca.get('Asset_Options__r'));
 //   ao = ca.get('Asset_Options__r');
 //   if(ao != null) {
//      ... do something
//    } else {  -- do something..
//   }
  ...
  ...
   }