---
schema_version: "1"
id: d28177a6a5f4770a76322b68c5df94f2841c5f60795b0890d979e4c820cdb234
title: OpportunityPartner
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_opportunitypartner.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunitypartner.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1ee3b86874f03b577500552e3d04fbf3b58ee1d9a482aa4237e5e145734eb08c
description: This object represents a partner relationship between an Account and an Opportunity. An OpportunityPartner record is created automatically when a Partner record is created for a partner relationship between an account and an opportunity.
---
# OpportunityPartner

This object represents a partner relationship between an Account and an Opportunity. An OpportunityPartner record is created automatically when a Partner record is created for a partner relationship between an account and an opportunity.

## Supported Calls

create(), delete(), describeLayout(), describeSObjects(), query(), retrieve()

## Special Access Rules

Customer Portal users can't access this object.

## Fields

| Field | Details |
| --- | --- |
| AccountToId | 
Type

reference

Properties

Create, Filter, Group, Sort

Description

ID of the partner Account in the partner relationship.

This is a relationship field.

Relationship Name

AccountTo

Relationship Type

Lookup

Refers To

Account



 |
| IsPrimary | 

Type

boolean

Properties

Create, Defaulted on create, Filter, Group, Sort

Description

Indicates whether the account is the opportunity’s primary partner (true) or not (false). Label is **Primary**.



 |
| OpportunityId | 

Type

reference

Properties

Create, Filter, Group, Sort

Description

ID of the Opportunity that is in the partner relationship.

This is a relationship field.

Relationship Name

Opportunity

Relationship Type

Lookup

Refers To

Opportunity



 |
| ReversePartnerId | 

Type

reference

Properties

Filter, Group, Nillable, Sort

Description

ID of the reciprocal OpportunityPartner record in a partner relationship.



 |
| Role | 

Type

picklist

Properties

Create, Filter, Group, Nillable, Sort

Description

The UserRole that the Account has on the Opportunity. For example, Reseller or Manufacturer.



 |

## Creating an Account-Opportunity Partner Relationship

When you create a partner relationship between an account and an opportunity (when you create a Partner record and specify the OpportunityId field), the API automatically creates two OpportunityPartner records, one for the forward relationship and one for the reverse.

- The value of the Partner field AccountToId maps to the value of the OpportunityPartner field AccountToId.
- The values of the OpportunityId, Role, and IsPrimary fields in both the Partner and OpportunityParnter records are the same.
- If you set the IsPrimary value to 1 (true) upon insert of a new OpportunityPartner, the IsPrimary value is automatically set to 0 (false) for any existing primary partners for that opportunity.

This mapping allows the API to manage the records and their relationships efficiently.

#### See Also

- [Partner](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_partner.htm "Represents a partner relationship between two Account records or between an Opportunity record and an Account record.")
- [AccountPartner](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_accountpartner.htm "This object represents a partner relationship between two Account records. An AccountPartner record is created automatically when a Partner record is created for a partner relationship between two accounts. An AccountPartner record is also created automatically between an account and an opportunity’s account when a Partner record is created between an account and an opportunity.")