Represents an opportunity, which is a sale or pending deal.
create(), update(), delete(), query(), search(), retrieve(), getDeleted(), getUpdated(), describeSObjects(), upsert()
| Field | Field Type | Field Properties | Description |
|---|---|---|---|
| AccountId | reference | Create | Id of the account associated with this opportunity. |
| Amount | currency | Create | Estimated total sale amount. For opportunities with products, the amount is the sum of the related products. Any attempt to update this field, if the record has products, will be ignored. The update call will not be rejected, and other fields will be updated as specified, but the Amount will be unchanged. |
| CampaignId | reference | Create | ID of a related Campaign. This field is defined only for those organizations that have Campaigns enabled as a feature. The User must have read access rights to the cross-referenced Campaign object in order to create() or update() that campaign into this field on the opportunity. |
| CloseDate | date | Create | Required. The date when the opportunity is expected to close. |
| ConnectionReceivedID | reference | Filter | ID of the PartnerNetworkConnection that shared this record with your organization. This field is only available if you have enabled Salesforce to Salesforce. |
| ConnectionSentID | reference | Filter | ID of the PartnerNetworkConnection that you shared this record with. This field is only available if you have enabled Salesforce to Salesforce. |
| CurrencyIsoCode | picklist | Create |
Available only for organizations with the multicurrency feature enabled. Contains the ISO code for any currency allowed by the organization. If the organization has multicurrency and a Pricebook2 is specified on the opportunity (i.e., the Pricebook2Id field is not blank), then the currency value of this field must match the currency of the PricebookEntry objects that are associated with any opportunity line items it has. |
| Description | textarea | Create | Text description of the opportunity. Limit: 32,000 characters. |
| ExpectedRevenue | currency | Filter | A read-only field that is equal to the product of the opportunity Amount field and the Probability. You cannot directly set this field, but you can indirectly set it by setting the Amount or Probability fields. |
| Fiscal | string | Filter | If fiscal years are not enabled, the name of the fiscal quarter or period in which the opportunity CloseDate falls. Value should be in YYY Q format, for example, '2006 1' for first quarter of 2006. |
| FiscalQuarter | int | Filter | Represents the fiscal quarter. Valid values are 1, 2, 3, or 4. |
| FiscalYear | int | Filter | Represents the fiscal year, for example, 2006. |
| ForecastCategory | picklist |
Create and Defaulted on createFilter and NillableRestricted picklistUpdate |
A restricted picklist field. It is implied, but not directly
controlled, by the StageName field. You can override this field to a different
value than is implied by the StageName value. The values of this field are fixed enumerated
values. The field labels are localized to the language of the user
performing the operation, if localized versions of those labels are
available for that language in the Salesforce user
interface. In API version 12.0 and later, the value of this field is automatically set based on the value of the ForecastCategoryName and cannot be updated any other way. The field properties Create, Defaulted on create, Nillable, and Update are not available in version 12.0. |
| ForecastCategoryName | picklist | Create |
Available in API version 12.0 and later. The name of the forecast category. It is implied, but not directly controlled, by the StageName field. You can override this field to a different value than is implied by the StageName value. |
| HasOpportunityLineItem | boolean | Defaulted on create | Read-only field that indicates whether the opportunity has associated line items. A value of true means that Opportunity line items have been created for the opportunity. An opportunity can have opportunity line items only if the opportunity has a price book. The opportunity line items must correspond to PricebookEntry objects that are listed in the opportunity Pricebook2. However, you can insert opportunity line items on an opportunity that does not have an associated Pricebook2. For the first opportunity line item that you insert on an opportunity without a Pricebook2, the API automatically sets the Pricebook2Id field, if the opportunity line item corresponds to a PricebookEntry in an active Pricebook2 that has a CurrencyIsoCode field that matches the CurrencyIsoCode field of the opportunity. If the Pricebook2 is not active or the CurrencyIsoCode fields do not match, then the API returns an error. You cannot update() the Pricebook2Id or PricebookId fields if opportunity line items exist on the Opportunity. You must delete() the line items before attempting to update the PricebookId field. |
| IsClosed | boolean | Defaulted on create | Directly controlled by StageName. You can query and filter on this field, but you cannot directly set it in a create(), upsert(), or update() request. It can only be set via StageName. Label is Closed. |
| IsDeleted | boolean | Defaulted on create |
Indicates whether the record has been moved to the Recycle Bin (true) or not (false). Label is Deleted. |
| IsWon | boolean | Defaulted on create | Directly controlled by StageName. You can query and filter on this field, but you cannot directly set it in a create(), upsert(), or update() request. It can only be set via StageName. Label is Won. |
| LastActivityDate | date | Filter |
Value is one of the following, whichever is the most recent:
|
| LeadSource | picklist | Create | The source of this opportunity, such as Advertisement or Trade Show. |
| Name | string | Create | Required. A name for this opportunity. Limit: 80 characters. |
| NextStep | string | Create | Description of next task in closing opportunity. Limit: 255 characters. |
| OwnerId | reference | Create | ID of the User who has been assigned to work this opportunity. If you have set up sales teams in your organization, updating this field has different consequences depending on your version of the API:
|
| Pricebook2Id | reference | Create | ID of a related Pricebook2 object. The Pricebook2Id field indicates which Pricebook2 applies to this opportunity. The Pricebook2Id field is defined only for those organizations that have products enabled as a feature. You can specify values for only one field (Pricebook2Id or PricebookId)—not both fields. For this reason, both fields are declared nillable. |
| PricebookId | reference | Create | Deprecated as of version 3.0. As of version 8.0, the Pricebook object is no longer available. Use the Pricebook2Id field instead, specifying the ID of the Pricebook2 object. |
| Probability | percent | Create | Percentage of estimated confidence in closing the opportunity. It is implied, but not directly controlled, by the StageName field. You can override this field to a different value than what is implied by the StageName. |
| StageName | picklist | Create | Required. Current stage of this record. The StageName field controls several other fields on an opportunity. Each of the fields can be directly set or implied by changing the StageName field. In addition, the StageName field is a picklist, so it has additional members in the returned DescribeSObjectResult to indicate how it affects the other fields. To obtain the stage name values in the picklist, invoke the query() call on the OpportunityStage object. If the StageName is updated, then the ForecastCategory is automatically updated based on the stage-category mapping. |
| TotalOpportunityQuantity | double | Create | The number of items included in this opportunity. Used in quantity-based forecasting. |
| Type | picklist | Create | The type of opportunity. For example, Existing Business or New Business. Label is Opportunity Type. |
Use the Opportunity object to manage information about a sale or pending deal. To update() an Opportunity, your client application needs “Edit” permission on opportunities. Client applications can create(), update(), delete(), and query()Attachments associated with an opportunity via the API. For a visual diagram of the relationships between Opportunity and other objects, see Product and Schedule Objects.
Client applications can also create or update opportunity objects by converting a Lead via the convertLead() call.