Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Do anybody know How to insert new Products and Price Book using Apex data loader. Every 1 product will have more that 1 price in price book. please guide me to possible ways to do.

share|improve this question

1 Answer 1

This might help you, I was looking for information on this myself and found the following information from the Salesforce boards quite useful.

Developer Force

How to insert/upload new Products, Price Books & Opportunity Line Item via Data Loader?

Questions this solution will help answer:

Step 1: How do I create and activate a Product Price Book?

Step 2: How do I load Products via the Data Loader?

Step 3: How do I load Products into Standard Price Book and Custom Price Books via the Data Loader?

Step 4: How do I load Opportunity Line Items via the Data Loader?

The following steps need to be taken in the exact order:


How do I create and activate a Product Price Book?

Step 1 - SET UP Price Books in Salesforce CRM Usually there are only a small finite set of price books, therefore this action can be done directly in the application. If you choose to use the Data Loader, use the "PriceBook2" table.

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

How do I load Products via the Data Loader?

Step 2a - PREPARE Products file (See attached template "Products_INSERT_Template_Step2a.csv")

  1. Make sure all Products have a Product Name -This is a required field when loading Products into the "Products2" Table
  2. If you use Record Types, you will need the "RecordTypeID" for the insert file -EXPORT "Record Type" table via the Force.com AppExchange Data Loader (you will need to check "Show all Sforce 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 fields in SFDC

Step 2b - INSERT Products to the "Products2" Table.

1.Open Data Loader 2. Insert to "Products2" table 3. Save success and error files in a folder for this project, you will use them in the Step 3b.


How do I load Products into Standard Price Book and Custom Price Books via the Force.com AppExchange Data Loader?

Step 3a - EXPORT "Price Book 2" Table You will need the "PriceBook2ID's" and other fields to prepare a file for the next step.

  1. Open the Data Loader
  2. Export the "Price Book 2" table
  3. You need "Price Book 2 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 3b - PREPARE file for Standard Price Book

NOTE: Even if you do not want to associate these Products with the Standard Price Book this step still must be followed.

Data Columns: -Product2ID: Use the "ID" from the "Product2" success file from Step 2 -PriceBook2ID: get the Standard Price Book ID from file created in Step 3a -CurrencyIsoCode: use Salesforce CRM currency symbol (only for Multi-Currency org) -Unit Price: this is the List Price/Standard Price field for the product -UseStandardPrice: this should be TRUE or FALSE and indicates whether to use the price from Standard Price Book or not. ----FALSE (only option for Standard Price Book) ----TRUE (is not an option because "Use Standard Price" field is not available in the Standard Price Book) -IsActive: TRUE (must be TRUE to insert - this can be changed to FALSE after Step 5 is complete)

Step 3c - INSERT into "Price Book Entry" Table

  1. Open the Data Loader
  2. Insert to "Price Book Entry" table
  3. Save success and error files in a folder for this project

Step 3d - PREPARE file for Custom Price Books Use the file from last step and modify it to have the Custom Price Book ID.

Data Columns: -Product2ID: Use the "ID" from the "Product2" success file from Step 2 -PriceBook2ID: get the Custom Price Book ID from file created in Step 3a -CurrencyIsoCode: use Salesforce currency symbol (only for Multi-Currency org) -Unit Price: this is the List Price/Standard Price field for the product -UseStandardPrice: this should be TRUE or FALSE and indicates whether to use the price from Standard Price Book or not. ----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) ----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) -IsActive: TRUE

Step 3e - INSERT into "Price Book Entry" Table MAKE SURE your Custom Price Books are Active in SFDC.

  1. Open Data Loader
  2. Insert to "Price Book Entry" table
  3. Save success and error files in a folder for this project

Step 3f (optional) INACTIVATE Standard Products in Standard Price Book

  1. Take the success files the Standard Price Book Entry insert from step 3c
  2. Change the values in "IsActive" from true to FALSE
  3. Map only the "Product2ID" and "IsActive" fields
  4. Open AppExchange Data Loader
  5. UPDATE "Price Book Entry" Table
  6. Save success and error files in a folder for this project

How do I load Opportunity Line Items via the Data Loader?

Step 4 (optional) INSERT products into "OpportunitiesLineItem" Table

  1. Data Columns: -Opportunity ID -PricebookEntryID -Total Price -Quantity -Unit price -other fields as needed NOTE: The Opportunity Product Table provides the "ProductID" as a mappable field, however this field should not be mapped in this process.

  2. Export the Opportunity Product (OpportunityLineItem) table for a template

  3. Export the appropriate Opportunities from the data loader with filter criteria.
  4. Copy OpportunityID into the insert/update template file.
  5. Export the "Price Book Entry" table from the data loader, the "ID" column is the PricebookEntryID.
  6. Copy the appropriate PricebookEntryID's (with corresponding Opportunities) into the insert/update file.
  7. Add the other data into the relevant columns in the insert/update file.
  8. Open AppExchange Data Loader.
  9. Insert to "Opportunity Product (OpportunityLineItem)" table
share|improve this answer
1  
Hi Adam & welcome to StackExchange. I'm sure this answer would get upvotes if you'd improve it a bit. Links tend to expire and we're encouraged to write a bit more about solutions, show more content, potential pitfalls, samples etc rather than be effectively a redirect ;) meta.stackexchange.com/questions/8231/… –  eyescream Jan 29 '13 at 18:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.