+ Start a Discussion
AndrewTaylorAndrewTaylor 

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 "System.trigger.new" 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?

 

 

Abhi_TripathiAbhi_Tripathi

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

aj2taylo2aj2taylo2

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