• utahsalesforcedeveloper
  • NEWBIE
  • 15 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I have Leads related to Accounts (Account__c field on Leads).  I am trying to write a SOQL statement that pulls in all Leads and Contacts associated with specific Accounts.  Here is a general SOQL which I thought should work, but keeps giving me an error message.
acc = [select id,name,industry,billingcountry,createdbyid,(select id,name,email,phone from contacts), (select id, FirstName, LastName from leads) from account limit 20];
I keep getting this error no matter how I try to pull the Lead relationship:  COMPILE ERROR: Didn't understand relationship 'leads' 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.

Any help would be greatly appreciated.
Thank you.
I have Leads related to Accounts (Account__c field on Leads).  I am trying to write a SOQL statement that pulls in all Leads and Contacts associated with specific Accounts.  Here is a general SOQL which I thought should work, but keeps giving me an error message.
acc = [select id,name,industry,billingcountry,createdbyid,(select id,name,email,phone from contacts), (select id, FirstName, LastName from leads) from account limit 20];
I keep getting this error no matter how I try to pull the Lead relationship:  COMPILE ERROR: Didn't understand relationship 'leads' 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.

Any help would be greatly appreciated.
Thank you.