Id of the account associated with this opportunity.
Amount
Type
currency
Properties
Create, Filter, Nillable, Sort, Update
Description
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
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
ID of a related Campaign. This field is defined only for those organizations that have
the campaign feature Campaigns enabled. 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
Type
date
Properties
Create, Filter, Group, Sort, Update
Description
Required. The date when the opportunity is expected to close.
ConnectionReceivedId
Type
reference
Properties
Filter, Nillable
Description
ID of the PartnerNetworkConnection that shared this record with your organization. This field
is only available if you have enabled Salesforce to Salesforce.
ConnectionSentId
Type
reference
Properties
Filter, Nillable
Description
ID of the PartnerNetworkConnection that you shared this record with. This field is only available
if you have enabled Salesforce to Salesforce. Beginning with API version
15.0, the ConnectionSentId field is no longer supported. The ConnectionSentId field is still visible, but the value is null. You can
use the new PartnerNetworkRecordConnection object to forward records to connections.
CurrencyIsoCode
Type
picklist
Properties
Create, Defaulted on create, Filter, Nillable, Restricted picklist, Update
Description
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 records that are associated with any opportunity line items
it has.
Description
Type
textarea
Properties
Create, Nillable, Update
Description
Text description of the opportunity. Limit: 32,000 characters.
ExpectedRevenue
Type
currency
Properties
Filter, Nillable, Sort
Description
A read-only field that is equal to the product of the opportunity Amount field and the Probability. You can’t directly set this field, but you can
indirectly set it by setting the Amount or Probability fields.
Fiscal
Type
string
Properties
Filter, Group, Nillable, Sort
Description
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
Type
int
Properties
Filter, Group, Nillable, Sort
Description
Represents the fiscal quarter. Valid values are 1, 2, 3, or 4.
FiscalYear
Type
int
Properties
Filter, Group, Nillable, Sort
Description
Represents the fiscal year, for example, 2006.
ForecastCategory
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
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 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
can’t be updated any other way. The field properties Create, Defaulted on create, Nillable, and Update are not available in version 12.0.
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
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
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 can’t 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
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Directly controlled by StageName. You can query and filter on this field, but you can’t
directly set it in a create, upsert, or update request. It can only
be set via StageName. Label is Closed.
IsDeleted
Type
boolean
Properties
Defaulted on create, Filter
Description
Indicates whether the object has been moved to the Recycle Bin (true) or not (false). Label is Deleted.
IsSplit
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Read-only field that indicates whether credit for the opportunity
is split between opportunity team members. Label is IsSplit.This field is available in versions 14.0 and later for organizations
that have enabled Opportunity Splits.
IsWon
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Directly controlled by StageName. You can query and filter on this field, but you can’t
directly set the value. It can only be set via StageName. Label is Won.
LastActivityDate
Type
date
Properties
Filter, Group, Nillable, Sort
Description
Value is one of the following, whichever is the most recent:
Due date of the most recent event logged against the record.
Due date of the most recently closed task associated with the
record.
LastReferencedDate
Type
date
Properties
Filter, Nillable, Sort, Update
Description
The timestamp for when the current
user last viewed a record related to this record.
LastViewedDate
Type
date
Properties
Filter, Nillable, Sort, Update
Description
The timestamp for when the current
user last viewed this record. If this value is null, this record might
only have been referenced (LastReferencedDate) and not viewed.
LeadSource
Type
picklist
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The source of this opportunity, such as Advertisement or Trade
Show.
Name
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
Required. A name for this opportunity. Limit: 120 characters.
NextStep
Type
string
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Description of next task in closing opportunity. Limit: 255 characters.
OwnerId
Type
reference
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
ID of the User who has been assigned to work this opportunity.
If you update
this field, the previous owner's access becomes Read Only or the access
specified in your organization-wide default for opportunities, whichever
is greater.
If you have set up opportunity teams in your organization,
updating this field has different consequences depending on your version
of the API:
For API version 12.0 and later, sharing records are kept, as they are
for all objects.
For API version before 12.0, sharing records are deleted.
For API version 16.0 and later, users must have the “Transfer
Record” permission in order to update (transfer) account ownership
using this field.
Pricebook2Id
Type
reference
Properties
Create, Defaulted on create, Filter, Group, Nillable, Sort, Update
Description
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
Type
reference
Properties
Create, Defaulted on create, Filter, Nillable, Update
Description
Unavailable 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 record.
Probability
Type
percent
Properties
Create, Defaulted on create, Filter, Nillable, Sort, Update
Description
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.
RecordTypeId
Type
reference
Properties
Create, Filter, Nillable, Update
Description
ID of the record type assigned to this object.
StageName
Type
picklist
Properties
Create, Filter, Group, Sort, Update
Description
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, query the OpportunityStage object. If the StageName is updated, then the ForecastCategoryName, IsClosed, IsWon, and Probability are automatically updated based on the stage-category
mapping.
SyncedQuoteID
Type
reference
Properties
Create, Filter, Nillable, Update
Description
Read only in an Apex trigger. The ID of the Quote that syncs with the opportunity. Setting this field lets you
start and stop syncing between the opportunity and a quote. The ID
has to be for a quote that is a child of the opportunity.
TotalOpportunityQuantity
Type
double
Properties
Create, Filter, Nillable, Sort, Update
Description
The number of items included in this opportunity. Used in quantity-based
forecasting.
Type
Type
picklist
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The type of opportunity. For example, Existing Business or New
Business. Label is Opportunity Type.
Usage
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().
Sample Code—Java
This code starts
the sync between an object and a child quote.
publicvoid startQuoteSync() {
Opportunity opp = new Opportunity();
opp.setId(new ID("006D000000CpOSy"));
opp.setSyncedQuoteId(new ID("0Q0D000000002OZ"));
// Invoke the update call and save the results try {
SaveResult[] saveResults = binding.update(new SObject[] {opp});
// check results and do more processing after the update call ...
}
catch (Exception ex) {
System.out.println("An unexpected error has occurred." + ex.getMessage());
return;
}
}
This code stops the sync between an object and a child
quote.
publicvoid stopQuoteSync() {
Opportunity opp = new Opportunity();
opp.setId(new ID("006D000000CpOSy"));
opp.setFieldsToNull(new String[] {"SyncedQuoteId"} );
// Invoke the update call and save the results try {
SaveResult[] saveResults = binding.update(new SObject[] {opp});
// check results and do more processing after the update call ...
}
catch (Exception ex) {
System.out.println("An unexpected error has occurred." + ex.getMessage());
return;
}
}