Loading

Update Quote Line Item Products with Data Loader in Sales Cloud

Udgivelsesdato: Oct 8, 2026
Beskrivelse

Salesforce Sales Cloud does not allow you to update the Product on an existing Quote Line Item with Data Loader, due to the complications outlined in the article "Product mismatch in Quote's 'Quote Line Item' related list and Quote Line Item record".

As a workaround, re-insert the updated Quote Line Items as new records. Export the existing line items, update the export file with the new Product's Price Book Entry IDs, insert the new Quote Line Items associated to the new Products, and then delete the original Quote Line Items.

Løsning

This article answers how to change the Product on existing Quote Line Item (QuoteLineItem) records in Salesforce Sales Cloud by exporting, re-inserting, and deleting records with Data Loader.

Before You Start

Warning: Always back up your data before performing any data operation. See Export Backup Data from Salesforce in the Salesforce Help for more details. Run a test with a small subset of records first. Then open the corresponding records in Salesforce and verify manually that they are correct.

Step 1: Export the Existing Quote Line Items

Export the existing Quote Line Item (QuoteLineItem) records using Data Loader:

  1. Open Data Loader and select Export. Log in if prompted, then click Next.
  2. In Step 2: Select Data Objects, check Show all Salesforce objects and select Quote Line Item (QuoteLineItem). Click Browse, choose a location and file name for the exported CSV file, click Save, and then click Next.
  3. Click Select all fields. Optionally, add filter conditions to limit the results to the records you want to update. Click Finish, and then click Yes.

Note: If Data Loader is not yet installed, review the Data Loader installation procedure listed in Additional Resources.

Step 2: Update the Export File with the New Products

Rename the ID column in your export file to "OLD ID". Then update the existing values in the PRICEBOOKENTRYID column with the PricebookEntryIds of the new Products that you want.

Note: A quote must have a price book selected to add Products, and you can only add Products from a single price book. Changing the selected price book deletes all existing Products from the quote.

You can update a Quote's assigned price book with Data Loader through the Quote's Pricebook2Id field, but only when the Quote does not have any associated line items. If Products are associated through Quote Line Items, you receive the error "INVALID_FIELD_FOR_INSERT_UPDATE: You Cannot Modify The Quote Price Book On Quotes Which Have Quote Line Items" when you update the Quote's Pricebook2Id.

Find the PricebookEntryIds

If you do not know the PricebookEntryIds of the new Products, use one of the following options.

Option A: Retrieve the PricebookEntryId in the User Interface

Go to the Price Books tab and open the price book that contains the new Products and is also assigned to the Quote. Click the View action for the corresponding Product in the Products section of the price book page. This opens the Price Book Entry record, and the URL in your browser contains the PricebookEntry Id.

For example, in the URL https://YourInstanceOrMyDomainHere.salesforce.com/01ua000000fgBO4, the ID is 01ua000000fgBO4.

Option B: Identify the Price Book Assigned to Each Quote

Identify which price books are assigned to each Quote that you want to update. Then use the corresponding Price Book Ids to query the PricebookEntry object and generate a list of Products with their PricebookEntryIds. Use that list as a reference when you update your export file.

To identify the price book currently assigned to the Quote and get its Pricebook Id, use either of these methods:

  • Open Data Loader and select Export. Check Show all Salesforce objects and select the Quote (Quote) object. In Step 3: Edit your Query, paste the query below. The query generates a CSV file that lists all of your existing Quotes with their Id, Name, and assigned Pricebook2Id (the Price Book's Id).

SELECT Id, Name, Pricebook2Id FROM Quote

  • Open the Quote record in Salesforce. If it has an assigned price book, the price book name appears in parentheses after the title of the Quote Line Items related list. For example, "Quote Line Items (Standard Price Book)" means that the Quote is assigned the Standard Price Book. Open that price book from the Price Books tab, which you can find in the All Tabs view. The URL in your browser then contains the Price Book's Id. For example, in the URL https://YourInstanceOrMyDomainHere.salesforce.com/01sa0000000L81b, the Pricebook Id is 01sa0000000L81b.

After you have the Quote's assigned Pricebook Id, generate a list of the Products in the price book to get the PricebookEntryIds of the new Products.

Option C: Export the PricebookEntryIds for a Price Book

Create a list of PricebookEntryIds for a particular price book with Data Loader. Select Export, check Show all Salesforce objects, and select Price Book Entry (PriceBookEntry). Select the following query fields, plus any additional fields that help you identify the desired Product:

  • Id
  • Name
  • Pricebook2Id
  • Product2Id

Add the filter condition Pricebook2Id equals the Pricebook Id from Option B. For example, if your Pricebook Id is 01sa0000000L81b, the filter is Pricebook2Id equals 01sa0000000L81b. Click Add Condition. The generated query in the Data Loader editor looks similar to this query, which returns the Id, Name, Pricebook2Id, and Product2Id of every entry in the selected price book:

Select Id, Name, Pricebook2Id, Product2Id FROM PricebookEntry WHERE Pricebook2Id = '01sa0000000L81b'

Click Finish, and then click Yes when prompted to begin the export. The ID column in the resulting CSV file contains the PricebookEntryIds. Use them as a reference to update your Quote Line Item export file with the new Products, as described in Step 2.

Step 3: Insert the Quote Line Items with the Updated Products

After you update the Quote Line Item export file with the PricebookEntryIds of the new Products and save it, you are ready to re-insert the Quote Line Items.

Note: To keep the original Quote Line Item audit field data (Created By and Last Modified By), enable the "Set Audit Fields upon Record Creation" feature before you proceed. See the article "Enable the 'Create Audit Fields' Permission in Salesforce" in the Salesforce Help for more details.

  1. Open Data Loader and choose Insert.
  2. In Step 2: Select Data Objects, check Show all Salesforce objects and select Quote Line Item (QuoteLineItem). Click Browse, select your updated export file that contains the new Products, click Open, and then click Next.
  3. In Step 3: Mapping, click Create or Edit a Map and choose Auto-Match Fields to Columns. Unmap the PRODUCT2ID field by dragging it from the column mapping in the bottom pane up to the top pane. This prevents the old Products from being associated incorrectly with the newly inserted line items.
  4. After all fields are mapped except PRODUCT2ID, click OK, and then click Next.
  5. Click Browse to select where to save the Success and Error files on your local machine. Click Finish, and then click Yes.

If the insert succeeds, your Quote contains both the original Quote Line Items and the newly inserted line items with their updated Products. If the insert fails, review the error messages in the Error file, make the necessary corrections, and attempt the insert again.

Step 4: Delete the Original Quote Line Items

Delete the original Quote Line Items, because you have re-created them with the updated Products.

  1. In Data Loader, select Delete.
  2. In Step 2: Select Data Objects, check Show all Salesforce objects and select Quote Line Item (QuoteLineItem). Click Browse, select your export file that contains the OLD ID column from Step 2, click Open, click Next, and then click OK.
  3. In Step 3: Mapping, click Create or Edit a Map and drag the Id column in the top pane down to match the "OLD ID" file header. Confirm that OLD ID is mapped to Id, click OK, and then click Next.
  4. Click Browse to select where to save the Success and Error files on your local machine. Click Finish, and then click Yes.

If the delete succeeds, your Quotes contain only the newly inserted line items with the updated Products. If the delete fails, review the error messages in the Error file, make the necessary corrections, and attempt the delete again.

Vidensartikelnummer

000381645

 
Indlæser
Salesforce Help | Article