Represents an opportunity line item, which is a member of the list of Product2 products associated with an Opportunity, along with other information about those products on that opportunity.
create(), update(), delete(), describeSObjects(), query(), retrieve(), getDeleted(), getUpdated(), upsert()
The user must have the “Edit” permissions on Opportunity records in order to create() or update() opportunity line items on an opportunity.
| Field | Field Type | Field Properties | Description |
|---|---|---|---|
| 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. 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 | picklist | Filter | 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 enabled, and a Pricebook2 is specified on the parent opportunity (that is,, the Pricebook2Id field is not blank on the opportunity referenced by this object’s OpportunityId), then the value of this field must match the currency of the CurrencyIsoCode field on the PricebookEntry objects that are associated with this object. |
| Description | string | Create | Text description of the opportunity line item. Limit: 255 characters. |
| Discount | percent | Create | The discount for the product as a percentage.
In an update() call, if you specify Discount without specifying TotalPrice, the TotalPrice will be adjusted to accommodate the new Discount value, and the UnitPrice will be held constant. If you specify both Discount and Quantity, you must also specify either TotalPrice or UnitPrice so the system can determine which one to automatically adjust. |
| HasQuantitySchedule | boolean | Defaulted on create | Read-only. Indicates whether a quantity schedule has been created for this object (true) or not (false). |
| HasRevenueSchedule | boolean | Defaulted on create | Read-only. Indicates whether a revenue schedule has been created
for this object (true) or not (false). If this object has a revenue schedule, the Quantity and TotalPrice fields cannot be updated. In addition, the Quantity field cannot be updated if this object has a quantity schedule. The API ignores any attempt to update these fields. The update() call will not be rejected but the updated values will be ignored. |
| ListPrice | currency | Filter | Corresponds to the UnitPrice on the PricebookEntry that is associated with this line item, which can be in the standard pricebook or a custom pricebook. A client application can use this information to show whether the unit price (or sales price) of the line item differs from the pricebook entry list price. |
| OpportunityId | reference | Create | Required. ID of the associated Opportunity. |
| PriceBookEntryId | reference | Create | Required. ID of the associated PricebookEntry. Exists only for those organizations that have Products enabled as a feature. You can specify values for either this field or ProductId, but not both. For this reason, both fields are declared nillable. |
| ProductId | reference | Create | ID of the associated Product object. This field is unavailable as of version 3.0 and is only provided for backward compatibility. The Product object is unavailable beginning with version 8.0. Use the PriceBookEntryId field instead, specifying the ID of the PricebookEntry object. |
| Quantity | double | Create | Read-only if this record has a quantity schedule, a revenue
schedule, or both a quantity and a revenue schedule. In an update() call, if you specify Quantity without specifying the UnitPrice, the UnitPrice value will be adjusted to accommodate the new Quantity value, and the TotalPrice will be held constant. If you specify both Discount and Quantity, you must also specify either TotalPrice or UnitPrice so the system can determine which one to automatically adjust. |
| ServiceDate | date | Create | Date when the product revenue will be recognized and the product
quantity will be shipped. Whether this value is used by customizable
forecasting depends upon the Forecast Date setting
for the organization:
|
| SortOrder | int | Filter | Number indicating the sort order selected by the user. Client applications can use this to match the sort order in Salesforce.com. |
| Subtotal | currency | Filter | This field shows the difference between standard and discounted pricing. Converted currency amounts when the opportunity's currency is different from the user's currency. |
| TotalPrice | currency | Filter | This field is available only for backward compatibility. It
represents the total price of the OpportunityLineItem. If you do not specify UnitPrice, this field is required. If you specify Discount and Quantity, this field or UnitPrice is required. In a given update() call, you can change either this value or the UnitPrice, but not both at the same time. This field is nillable, but you cannot set both TotalPrice and UnitPrice to null in the same update() call. To insert the TotalPrice for an opportunity line item via the API (given only a unit price and the quantity), calculate this field as the unit price multiplied by the quantity. This field is read-only if the opportunity line item has a revenue schedule. If the opportunity line item does not have a schedule or only has quantity schedule, this field can be updated. |
| UnitPrice | currency | Create | The unit price for the opportunity line item. In the Salesforce.com user
interface, this field’s value is calculated by dividing the total
price of the opportunity line item by the quantity listed for that
line item. Label is Sales Price. This field or TotalPrice is required. You cannot specify both. If you specify Discount and Quantity, this field or TotalPrice is required. |
An Opportunity can have OpportunityLineItems only if the Opportunity has a Pricebook2. An OpportunityLineItem must correspond to a Product2 that is listed in the opportunity's Pricebook2. For information about inserting OpportunityLineItem for an opportunity that does not have an associated Pricebook2 or any existing line items, see Effects on Opportunities.
This object is defined only for those organizations that have products enabled as a feature. If the organization does not have the products feature, this object does note appear in the describeGlobal() call, and you cannot use describeSObjects() or query() with the OpportunityLineItem object.
For a visual diagram of the relationships between OpportunityLineItem and other objects, see Product and Schedule Objects.