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

OpportunityLineItem UnitPrice - Cannot change both 'UnitPrice' and 'TotalPrice' in update call

I have a trigger that's updating the UnitPrice of an existing OpportunityLineItem.


When this happens, I get the error "Cannot change both 'UnitPrice' and 'TotalPrice' in update call".  The TotalPrice is not being touched in this segment of code.  When I write the contents of the update call to the System log, the TotalPrice is not included.


However, when this update is called, a Before Update Trigger is fired, and when I write "" to the error log, I can now see the TotalPrice (not sure if now the system believes I'm setting both values in my call?)


Any advice/thoughts on this?




UnitPrice can be updated BUT TotalPrice can't be updated because its a formula fields, its value depends on unitPrice value


Thanks for the reply Abhi;  however, I mentioned that I'm not touching the TotalPrice value, but getting this error.