+ Start a Discussion

Auto Update Total Price of an Opportunity Product after Discount Approval

Hi Guys,


I'm a newbie on Apex Triggers. I need your your help on eliminating a task process using Apex triggers. Below is the scenario. 


When a Opportunity Product is entitled for a discount, a request for discount approval is submitted. Once the request is approved, the total price for each product doesn't update. It will only be updated once the product is edited and saved.


Is there a way or a code that automates that functionality where the Total Price is updated automatically when the discount is approved?


Thank you in advance!





Since you didn't specify more details on Approval... I will suggest you a simple question.

A field update on Opportunity Product on Approval Actions should be able to do required updates,

make sure you CHECK "Re-evaluate Workflow Rules after Field Change" on the approval process.


Thanks for your reply.


Sorry for not being detailed. I was a real newbie on it. Your proposed solution would be perfect only if I can add Total Price on the Field Updates. But I couldn't see the Total Price field on the Standard Fields dropdown. Is there a way I can add Field Updates with this field?


Thanks again!


I still don't get all details.


On which object do you submit you approval?  I guess Opportunity, Opportunity Product doesn't allow any approvals out of the box.


Is Total_Price on Opportunity?


FYI... Opportunity Products have lot of limitation.


We're getting close on being on the same page.


Here's a bigger picture. There are two important custom fields under Opportunity -- Submitted Discount Approval Request & Discount Approved, both of them are checkbox and are uncheked/false by default. 


Submitted Discount Approval Request field should be checked before an Opportunity can be submitted for Approval on the Approval History block under the opportunity page. After submission, a new entry on the Approval History block will ask to approve or reject the request. If the manager approves it, the Discount Approved field will become checked/true.


Now here's the thing, on the Opportunity products, below are the fields,

Action            Product                                 Quantity Sales Price Discount Amount Total Price Date Line Description

Edit |  DelGenWatt Diesel 1000kW2.00$100,000.00$20,000.00 $200,000.00



If the Opportunity Discount Approved field becomes checked/true, the Total Price field of Opportunity Products(s) should automatically be updated based on (Total Price - Discount Amount). What happens now is, I need to edit and save the Opportunity product before the changes take effect.


So basically, the Total Price should automaticall become $180,000.00 after the Discount Approved field of the Opportunity has been checked/true -- this happens when the Submit for Approval is Accepted by the Approver.

Thanks a lot!