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
saarikogmailsaarikogmail 

Can I update Product Total Price in an opportuinity?

I want to update the product total price in an opportuinity line item. The idea is that I can add an amount in a new field (which is a discount per line item) and that reflects in the total price.

 

How can I do it?

shillyershillyer

You can create a Discount field on the Opportunity of type percentage and then create a cross-object formula field on the Opportunity Products with the following formula:

 

TotalPrice - (TotalPrice *( Opportunity.Discount__c ))

 

But this won't affect the Opportunity Amount, because that uses the Opportunity Product Total Price.

 

So if you are trying to calculate the discount against the Opportunity Amount, then I suggest creating 2 new fields on the Opportunity. First field is a Discount field (type=percentage) and the second field is the Discounted Total with the following formula:

 

Amount - (Amount*(Discount__c))

 

This way you can track the Original Amount, Discount and Discounted Total.

 

Hope that helps,

Sati

saarikogmailsaarikogmail

Thank you, but I want to give the discount per item (opportuinity line) and not for the entire opportuinity. And that the entire oportuinity will be recalculated.

 

I don't see how this solution can help me here.  

shillyershillyer

So once you specify the discount on the Opportunity, you want the user to be able to specify which line items the discount should apply to?

 

If that is true, you could create a custom list button on the Opportunity Products related list that allows the user to check what line items to discount. You can then use the API or Apex Code to apply the discount and update the Opportunity Amount field.

 

Hope that helps,

Sati