You are using an older browser that might negatively affect how this site is displayed. Please update to a modern browser to have a better experience. Sorry for the inconvenience!

Customizing Pricebook Entries In Salesforce


 Submitted by Admin on 09/29/2014

Customizing Pricebook entries in Salesforce

Price Book Entry

  • In Salesforce.com, Pricebook entry object acts as a junction object between Pricebook and Products. In Winter14, there was no feature for customizing your Pricebook entry.  From Summer14, you can customize your Pricebook entry.
  • In Salesforce.com, there are two types of Pricebook entries are available. Such as,
    1. Standard Pricebook entry
    2. Custom Pricebook entry
    3. Standard Pricebook entry represents default prices for the products that are sold.
    4. Custom Pricebook entry represents list prices for the products that are sold. Without adding the product to the Standard Pricebook, we cannot add it to Custom Pricebook and also the particular Pricebook should be active.

To learn more about PriceBook entry follow this link: Salesforce Price Book Entries Overview

Customize your Pricebook entry

  • In summer 14, Salesforce.com enhanced Pricebook entry, in such a way that a user can create fields, Page layouts, Validation rules, field sets, and search layouts available for customization in Pricebook entry object.
  • Data migration can be done easily, as we can create custom fields (Using External Id).
  • Maximum number of custom fields in Pricebook entry is 50. When you delete a custom field that is used in any view for filter purpose, then the result of the view will be changed. Also, the result of Assignment and Escalation rules will get changed.

Pricebook

Once you created your custom Pricebook and products, you can view the detail of the Pricebook entry.

Pricebook

Then, click the view link in your products related list. Then, you see the particular Pricebook entry in the detailed page.

Pricebook

Usage of Pricebook entry in Test Class:

  • With the summer14 release, we don’t need to use @isTest (SeeAllData=True) annotation in test classes related with PriceBook entry.
  • Before summer 14, we must use @isTest (SeeAllData = True) annotation in your test class.

If you need to learn about this follow the Url  : Using Salesforce PriceBook Entry in Test Class.

Example:

@isTest

Public class PriceBookEntryTestClass

{

Public static void createNewPriceBookEntry()

{

PricebookEntry pricebookent = new PricebookEntry();

Product2 product = new Product2();

product.Name = ‘Samsung GT-7582′;

insert product;

Pricebook2 pricebook = new Pricebook2();

pricebook.Name = ‘Samsung Galaxy PriceBook’;

insert pricebook;

pricebookent.Product2Id = product.Id;

pricebookent.Pricebook2Id = pricebook.Id;

pricebookent.UnitPrice = 9000.00;

pricebookent.IsActive = true;

Insert pricebookent;

System.assertEquals(pricebookent.UnitPrice, 9000.00);

}

}

Conclusion:

Price book Entry customization makes data migration easy, and optimizes the Test class usage.