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
Serghei SleptovSerghei Sleptov 

OpportunityLineItem trigger

Hi Folks,

Does anyone have an example of trigger that recalculates UnitPrice of an Opportunity Line Item on insert/update based on a filed value of a related opportuniuty?
 
Thank you.
pconpcon
I do not have an example trigger but this is a pretty straight forward trigger that you would get the Id of the opportunities  you want to recalculate the line item prices.  Then query all of the opportunity line items associated with those opportunity ids.  Then update each of the unit prices and then update the line items.

If you have specific Apex code that you are having issues with, please include it here and we can try to help you get it working correctly.

NOTE: When including code please use the "Add a code sample" button (icon <>) to increase readability and make referencing code easier.