Customizing Pricebook Entries In Salesforce

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.

 Submitted by Admin on 09/29/2014Tags: Apex Test Class Pricebook Entries Salesforce

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.

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Harnessing Generative AI in Healthcare Insurance: Streamlining Operations and Enhancing Member Insights

Healthcare insurance providers are navigating new ground and capitalizing on new opportunities made possible through artificial intelligence. AI can be utilized to lower costs for payers and improve the member experience as well as the overall health and well-being of members, leading to greater member satisfaction and improving trust and reputation for the payer’s brand.

Read Article »

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.