function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
billgreenhawbillgreenhaw 

Update Product (PriceBookEntryId) on OpportunityLineItem

I have a scenario right now where we have had to change many products on Opportunities based on Opportunity Type. I have the SOQL, etc...all working to find the correct products I need to change and the correct PriceBookEntryId to update for the line items.

 

But looks like I cannot update the PriceBookEntryId field on OpportunityLineItem object. Is this correct? Is the only way to do what I need to do really to insert new line items and delete the old line items?  This is a ton of rows that I would need to do it and much easier/straight forward to simply update the pricebookentryid field.

 

Thanks for any thoughts or suggestions.

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

PricebookEntryId is indeed read-only. You will need to delete all rows that need to be changed.

All Answers

sfdcfoxsfdcfox

PricebookEntryId is indeed read-only. You will need to delete all rows that need to be changed.

This was selected as the best answer
SA_AdminSA_Admin

Thank you for your reply.  I know it has been a few months but it saved me from headache today.

 

:)