function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Support 3743Support 3743 

Finding partner related to an opportunity

I'm having trouble understanding the relationship between Partner and Opportunity. I want to access the data of the partner related to an opportunity. Opportunity has a field called PartnerAccount:
User-added image
However when I use this code: SELECT PartnerAccount.Name FROM Opportunity
There is an error: No such relation 'PartnerAccount' on entity 'Opportunity'

Can anyone tell me why? And how could I access the information in partner when I'm querying opportunity? Thanks!
 
Chandra@AtlantaChandra@Atlanta
Support 3743,

It looks like Partner is a custom object? if yes, then you refere to customer object with __c and relationship will be represented by __r.  Below is a query example considering the scenario

Partner -- child
opportunity -- parent

select name, opportunity__r.name
from
partner__c

By Falcon100 (if this was helpful, please provide feedback)
 
Support 3743Support 3743
@AtlantaFalcon100, I appreciate the help but Partner is not a custom object. I tried the code and it failed
Chandra@AtlantaChandra@Atlanta
Support 3743,

if it is not a customer object then you can use the object name directly

select name, opportunity.name
from
partner

By Falcon100 (if this was helpful, please provide feedback)