Salesforce Tip: Opportunity, Product and Pricebook. How are they related?
In Saleforce.com, the Opportunity, Product and Pricebook are standard objects. How are they related?
In actual fact, an opportunity has one or more products and vice versa, a product can be prospected in one or more opportunities.
This means, a many-to-many relationship between opportunity and product (please refer to Figure 1).
Next, let’s look at the relation between products and pricebooks. A product may have one or more different sets of pricebook and a pricebook can contain one or more products.
Again, it is a many-to-many relationship model (please refer to Figure 1).
In order to set up these 2 relations in Salesforce, 2 more objects have to be created. These 2 objects will be the junction objects (as listed below):
- OpportunityLineItem (please refer to Figure 2)
- PricebookEntry (please refer to Figure 2)
- Opportunity object stores data of potential sales and pending sales.
- One opportunity can only have one pricebook.
- One opportunity can contain one or many line items.
- Product object is a catalogue of items or services for sales.
- A product may contain one or more different sets of prices (PriceBookEntry).
- List of products that link with opportunity containing data on types of products and respective prices.
- One opportunity line item can only be linked to one opportunity.
- One opportunity line item can only be linked to one price book entry.
- PricebookEntry object is a product entry in a pricebook.
- This object allows products to be linked to standard price book or custom price book.
- One price book entry is linked to only one product.
- One price book entry can only appear in one pricebook.
- One price book entry can be used in multiple line items. This also further creates flexibility for users to set their own prices.
- Pricebook object store a list of products and services for sale.
- A pricebook can be used in one or more different opportunities.
- A pricebook has one or more different price entries.