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.

closed as off-topic by Sebastian Kessel, David Reed, Jayant Das, Mohith Shrivastava, glls Sep 13 '18 at 2:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Sebastian Kessel, David Reed, Jayant Das, Mohith Shrivastava, glls
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Is it Apex, formula field, VF lightning? – Pranay Jaiswal Sep 12 '18 at 14:16
  • Trying from SOQL queries Using Resetforce – Shahzaib Awan Sep 12 '18 at 14:17
  • The SOQL is on Contact? – Pranay Jaiswal 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? – Shahzaib Awan 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. – David Cheng 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.