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
SF-devSF-dev 

Creating Opportunity Partner records

I have added a Partner to an  Opportunity  from the Opportunity Detail page:  partner > New . 

 

However when I query the Opportunity Partner records as shown below , its giving me 2 records for the same Opportunity. 

 

SOQL used :

 

Select o.Role, o.ReversePartnerId, o.OpportunityId, o.IsPrimary, o.AccountTo.Name, o.AccountTo.Id, o.AccountToId From OpportunityPartner o where o.OpportunityId ='006T0000005RLCR'

 

Result : it returns 2 records ( with is identical)  where as the Opportunity has only one Opportunity Partner. 

 

after investigation , I came to know that the AccountToId is different in both the records - (a) one is the Account that I have selected while creating the partner  (b) other is the 'Account'  to which the Opportunity is linked.

 

I have checked the Partner records as well. 2 records created for the Partner as well.

 

SOQL used :

 

Select p.SystemModstamp, p.Role, p.ReversePartnerId, p.OpportunityId, p.LastModifiedDate, p.LastModifiedById, p.IsPrimary, p.AccountTo.Name, p.AccountToId, p.AccountFrom.Name, p.AccountFromId From Partner p where p.OpportunityId ='006T0000005RLCR'

 

Now my question is ,

 

1. What is the functionality behind this ? why 2 records get created when we add a partner to an opportunity ?

2. I need to clone the 'Partner' related to an Opportunity . Out of the 2 records which one I need to clone ? and for that what will be the query ?

 

Any help will be appreciated . Thanks in advance.