I have Contact Id and I want to find email of Account Owner not Owner of contact.Can you please provide me ref that what is the relation of contact with Account and how do we get Account Owner from contact.

  • Is it Apex, formula field, VF lightning? Sep 12 '18 at 14:16
  • Trying from SOQL queries Using Resetforce Sep 12 '18 at 14:17
  • The SOQL is on Contact? Sep 12 '18 at 14:17
  • Restforce force and queries account_owner_id = @client.query(“select AccountId from #{TABLE_NAME} where id = ‘#{id}‘“).first.try(:AccountId) @client.query(“select Email,FirstName from user where id = ‘#{account_owner_id}’“).first if account_owner_id.present? Sep 12 '18 at 14:18
  • There are many good resources on Salesforce Trailhead and in the documentation on SOQL basics and querying with relationships. Sep 12 '18 at 16:08

You can direcly use the below query.

Select id,Account.OwnerId From Contact

Account.OwnerID will return account ownerId.

Not the answer you're looking for? Browse other questions tagged or ask your own question.