You need to sign in to do that
Don't have an account?
Deepa Sekar
pricebookentryId field not writeable
Requirement: To remove existing OLI and reinsert with new totalPrice,UnitPrice,ProductCode,Product2ID, pricebookentryId obtained from Integration.
Steps:
1. List<OLI> oldRecords = new List<OLI>();
2. List<OLI> newRecords = oldRecords;
3 Modified the TotalPrice, UnitPrice added a debug statement and I get the new Prices.
4. Now I try to update the productCode, Product2ID and pricebookentryID
and get "Field is not writeable: OpportunityLineItem.PricebookEntryId".
Kindly suggest steps to overwrite "ProductCode,Product2ID, pricebookentryId" in apex class
Steps:
1. List<OLI> oldRecords = new List<OLI>();
2. List<OLI> newRecords = oldRecords;
3 Modified the TotalPrice, UnitPrice added a debug statement and I get the new Prices.
4. Now I try to update the productCode, Product2ID and pricebookentryID
and get "Field is not writeable: OpportunityLineItem.PricebookEntryId".
Kindly suggest steps to overwrite "ProductCode,Product2ID, pricebookentryId" in apex class
You cannot specify Product2Id while creating an OLI. Only specify the PricebookEntryId.
Refer the below link.
https://developer.salesforce.com/forums/?id=9060G0000005muNQAQ
If this helps, Please mark it as best answer.
Thanks!!
Thanks for the prompt reply but I am unable to edit PricebookEntryId as well.