Posts

Showing posts from March 2, 2019

SOQL getting the grandparent of an account from contact

Image
3 2 I am trying to get the Ultimate Parent Account from my contact up to 3rd level parent. Here is my SOQL code: SELECT Name,Account.Parent.Name, Account.Parent.Parent.Name, Account.Parent.Parent.Parent.Name FROM Contact I expect to see this result: Contact:{Name='Name of COntact',Parent='the parent name', ChildParent='Child Parent Name', GrandParent='Grand Parent Name'} OR Contact:{Name='Name of COntact',ParentId='the parent Id', ChildParentId='Child Parent Id', GrandParentId='Grand Parent Id'} Once I debug my query the result is not what i expected. Contact:{Name='Name of the Contact', AccountId='Parent Id', Id='Id of the Contact'} Anyone help? apex soql ...