Opportunity

Represents an opportunity, which is a sale or pending deal.

When importing opportunity data, users need the Set Audit Fields upon Record Creation permission to assign values to audit fields such as CreatedDate. Audit fields are automatically updated during API operations unless you set these fields yourself.

create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()

  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Relationship name: Account

  • Relationship type: relationship

  • Refers to: Account

  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Relationship name: ActivityMetric

  • Relationship type: relationship

  • Refers to: ActivityMetric

  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Relationship name: ActivityMetricRollup

  • Relationship type: relationship

  • Refers to: ActivityMetricRollup

  • Type: int
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 52.0
  • Type: currency
  • Properties: Create, Filter, Nillable, Sort, Update
  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Relationship name: Campaign

  • Relationship type: relationship

  • Refers to: Campaign

  • Type: date
  • Properties: Create, Filter, Group, Sort, Update
  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 11.0

  • Relationship name: ConnectionReceived

  • Relationship type: relationship

  • Refers to: PartnerNetworkConnection

  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 11.0

  • Relationship name: ConnectionSent

  • Relationship type: relationship

  • Refers to: PartnerNetworkConnection

  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort

  • Introduced: API version 46.0

  • Relationship name: Contact

  • Relationship type: relationship

  • Refers to: Contact

  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Introduced: API version 31.0

  • Relationship name: Contract

  • Relationship type: relationship

  • Refers to: Contract

  • Type: textarea
  • Properties: Create, Nillable, Update
  • Type: currency
  • Properties: Filter, Nillable, Sort
  • Type: picklist
  • Properties: Filter, Group, Nillable, Restricted picklist, Sort
  • Introduced: API version 62.0
  • Type: string
  • Properties: Filter, Nillable, Sort
  • Type: int
  • Properties: Nillable
  • Type: int
  • Properties: Nillable
  • Type: picklist
  • Properties: Create, Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort, Update
  • Type: picklist
  • Properties: Create, Defaulted on create, Filter, Group, Nillable, Sort, Update
  • Introduced: API version 12.0
  • Type: boolean

  • Properties: Defaulted on create, Group

  • Introduced: API version 35.0

  • Default value: false

  • Type: boolean

  • Properties: Defaulted on create, Filter, Group, Sort

  • Default value: false

  • Type: boolean

  • Properties: Defaulted on create, Group

  • Introduced: API version 35.0

  • Default value: false

  • Type: boolean

  • Properties: Defaulted on create, Group

  • Introduced: API version 53.0

  • Default value: false

  • Type: int
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 41.0
  • Type: boolean

  • Properties: Defaulted on create, Filter, Group, Sort

  • Default value: false

  • Type: boolean

  • Properties: Create, Defaulted on create, Filter, Group, Sort, Update

  • Introduced: API version 33.0

  • Default value: false

  • Type: boolean

  • Properties: Defaulted on create, Group

  • Introduced: API version 53.0

  • Default value: false

  • Type: boolean

  • Properties: Create, Defaulted on create, Filter, Group, Sort, Update

  • Default value: false

  • Type: boolean

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 14.0

  • Default value: false

  • Type: boolean

  • Properties: Defaulted on create, Filter, Group, Sort

  • Default value: false

  • Type: date
  • Properties: Filter, Group, Nillable, Sort
  • Type: int
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 52.0
  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 50.0

  • Relationship name: LastAmountChangedHistory

  • Relationship type: relationship

  • Refers to: OpportunityHistory

  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 50.0

  • Relationship name: LastCloseDateChangedHistory

  • Relationship type: relationship

  • Refers to: OpportunityHistory

  • Type: datetime
  • Properties: Filter, Nillable, Sort
  • Introduced: API version 52.0
  • Type: int
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 52.0
  • Type: datetime
  • Properties: Filter, Nillable, Sort
  • Introduced: API version 68.0
  • Type: picklist
  • Properties: Create, Filter, Group, Nillable, Sort, Update
  • Type: string
  • Properties: Create, Filter, Group, idLookup, Sort, Update
  • Description: The name of the Opportunity.
  • Type: string
  • Properties: Create, Filter, Group, Nillable, Sort, Update
  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Relationship name: OpportunityScore

  • Relationship type: relationship

  • Refers to: OpportunityScore

  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Introduced: API version 8.0

  • Relationship name: PartnerAccount

  • Relationship type: relationship

  • Refers to: Account

  • Type: reference

  • Properties: Create, Defaulted on create, Filter, Group, Nillable, Sort, Update

  • Introduced: API version 2.0

  • Relationship name: Pricebook2

  • Relationship type: relationship

  • Refers to: Pricebook2

  • Type: percent
  • Properties: Create, Defaulted on create, Filter, Nillable, Sort, Update
  • Type: int
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 53.0
  • Type: picklist
  • Properties: Create, Filter, Group, Sort, Update
  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Introduced: API version 18.0

  • Relationship name: SyncedQuote

  • Relationship type: relationship

  • Refers to: Quote

  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Introduced: API version 33.0

  • Relationship name: Territory2

  • Relationship type: relationship

  • Refers to: Territory2

  • Type: reference

  • Properties: Create, Filter, Group, Nillable, Sort, Update

  • Introduced: API version 7.0

  • Relationship name: Territory

  • Relationship type: relationship

  • Refers to: Territory

  • Type: reference

  • Properties: Filter, Group, Nillable, Sort

  • Relationship name: TopInsight

  • Relationship type: relationship

  • Refers to: TopInsight

  • Type: double
  • Properties: Create, Filter, Nillable, Sort, Update
  • Introduced: API version 7.0
  • Type: picklist
  • Properties: Create, Filter, Group, Nillable, Sort, Update

Use the Opportunity object to manage information about a sale or pending deal. You can also sync this object with a child Quote. To update an Opportunity, your client application needs Edit permission on opportunities. You can create, update, delete, and query Attachment records associated with an opportunity via the API. To split credit for an opportunity among multiple opportunity team members, use the OpportunitySplit object.

Client applications can also create or update opportunity objects by converting a Lead with convertLead().

On opportunities and opportunity products, the workflow rules, validation rules, and Apex triggers fire when an update to a child opportunity product or schedule causes an update to the parent record. This means your custom application logic is enforced when there are updates to the parent record, ensuring higher data quality and compliance with your organization’s business policies.

This code starts the sync between an object and a child quote.

This code stops the sync between an object and a child quote.

This object has the following associated objects. If the API version isn’t specified, they’re available in the same API versions as this object. Otherwise, they’re available in the specified API version.

If you are using before triggers to set Stage and Forecast Category for an opportunity record, the behavior is as follows:

  • If you set Stage and Forecast Category, the opportunity record contains those exact values.
  • If you set Stage but not Forecast Category, the Forecast Category value on the opportunity record defaults to the one associated with trigger Stage.
  • If you reset Stage to a value specified in an API call or incoming from the user interface, the Forecast Category value should also come from the API call or user interface. If no value for Forecast Category is specified and the incoming Stage is different than the trigger Stage, the Forecast Category defaults to the one associated with trigger Stage. If the trigger Stage and incoming Stage are the same, the Forecast Category is not defaulted.

If you are cloning an opportunity with products, the following events occur in order:

If errors occur on an opportunity product, you must return to the opportunity and fix the errors before cloning.

If any opportunity products contain unique custom fields, you must null them out before cloning the opportunity.