28 Jun 2024

How to insert new Products data and custom Price Books via Data Loader

Importing product names and prices into a custom price book in Salesforce involves a few steps: preparing your data, adding products to the standard price book, and then associating these products with the custom price book along with the specific pricing. Here’s a detailed guide on how to achieve this:


Create and activate a Product Price Book

Step 1 - Set up Price Books

You can create Price Books in Salesforce directly for a small finite set of Price Books. For creating multiple Price Books, you can use the Data Loader and import into the 'PriceBook2' object. Review Insert or update Price Books with Data Loader.

  1. In SFDC, click the Products tab.
  2. In the bottom right-hand corner, click Manage Price Books.
  3. Add as many Price Books as necessary. 
  4. The Standard Price Book MUST be active.

Import Products via the Data Loader

Step 2 - Prepare Product file

  1. Make sure all Products have a Product Name. This is a required field when loading Products into the 'Products2' object.
  2. If you use Record Types, you will need the 'RecordTypeID' for the insert file. Export the 'Record Type' field via the Data Loader (you will need to check 'Show all Salesforce Objects'). This export will provide the 18-digit ID, which is needed for the insert.
  3. Make sure your column headers in the file exactly match the fields in Salesforce.
  4. Open Data Loader and insert to 'Products2' object.
  5. Save success and error files in a folder, you will use them in the Step 3b.

Prepare the product data like this:
  • Name
  • Product A
  • Product B




Associate Products with Standard Price Book and Custom Price Books via the Data Loader

Step 3 - Export 'Price Book 2' object

Please use the 'PriceBook2 ID' (from Step 2a) and other fields to prepare a file for the next step.

  1. Open the Data Loader.
  2. Export the 'PriceBook2' object.
  3. You need 'PriceBook2 ID' for insert file.
  4. Save file in an easy to access location.
  5. This will be used to create your final insert file for Step 3c and 3e.

 
Step 4 - Prepare file for Standard Price Book

Note: Always first associate the Products with the Standard Price Book irrespective whether the Products are using Standard Price or not.

  1. Data Columns:
  1. Product2ID: Use the 'ID' from the 'Product2' success file from Step 2.
  2. PriceBook2ID: Get the Standard Price Book ID from file created in Step 3a.
  3. CurrencyIsoCode: (only for multi-currency orgs) Use SFDC currency symbol.
  4. Unit Price: this is the List Price/Standard Price field for the Product.
  5. UseStandardPrice: Do not map this field for Standard Price Book.
  6. IsActive: TRUE (must be TRUE to insert - this can be changed to FALSE after Step 5 is complete)
 
  1. Open the Data Loader click Insert, then under the list of Salesforce object choose Price Book Entry (PricebookEntry).
  2. Map the fields accordingly and do the import.
  3. Save success and error files in a folder.

Prepare the CSV with Product2Id, Pricebook2Id, UnitPrice, IsActive

Product2Id,Pricebook2Id,UnitPrice,IsActive
01t1N00000xxxxxxxx,01s1N00000Standard,100,true
01t1N00000yyyyyyyy,01s1N00000Standard,150,true



Step 4 - Prepare the file for Custom Price Books
 
  1. Use the file from last step and modify it to have the custom Price Book ID.
  2. The field UseStandardPrice plays an important role in inserting Price Books for custom Price Books: This should be TRUE (or 1) or FALSE (or 0) and indicates whether to use the price from Standard Price Book or not. See our SOAP API Developer Guide for PricebookEntry.
  1. FALSE (this choice means you will use the Unit Price from the custom Price Book and NOT the Unit Price from the Standard Price Book).
  2. TRUE (this option only works if this Product has been added to the Standard Price Book. This choice will use the Unit Price from the Standard Price Book. Note: Please provide the same unit price value as that of Standard Price book in this scenario).
  1. Follow the steps as provided in the Step 3b for Customer Price Book ID.

Prepare the CSV with Product2Id, Pricebook2Id, UnitPrice, IsActive, UseStandardPrice.

Product2Id,Pricebook2Id,UnitPrice,IsActive,UseStandardPrice

01t1N00000xxxxxxxx,01s1N00000Custom,90,true,false

01t1N00000yyyyyyyy,01s1N00000Custom,140,true,false




You can check Manage Price Books for you to track the prices of products and services that your company offers to customers.

No comments:

Post a Comment