You need to sign in to do that
Don't have an account?
Benjamin Culver
Track Opp Product Price increase year over year and lifetime total
Hello, all
I have added a percentage 'yearly increase' field to my Opp Product.
I am looking for a way to calculate the lifetime total of the product after x years (x being the 'term' field) if the price is increased by 'yearly increase' every year and how to track each year's price. This needs to work for any given term
for example.
Thank you for your time and help.
I have added a percentage 'yearly increase' field to my Opp Product.
I am looking for a way to calculate the lifetime total of the product after x years (x being the 'term' field) if the price is increased by 'yearly increase' every year and how to track each year's price. This needs to work for any given term
for example.
- product price = $100
- yearly increase = 3%
- term = 5
- year 1 price = 100
- year 2 price = 103
- year 3 price = 106.09
- year 4 price = 109.27
- year 5 price = 112.55
- lifetime total = 530.91
Thank you for your time and help.
Apologies from my end. Actually lookup field is not allowed , so this solution will not work and vf page cannot be embedded in opportunity Line item.
But we can add lightning component :
Controller JS
Apex Class
After adding the lightnig component it will look something like this below
Hope this helps!
All Answers
You can create a Term custom Object , it will be a lookup to (Opportunity Product).
create fields like Price__c
Then create a apex trigger on OpportunityProduct
I am assuming the fields for opportunitylineitem as i don't know the exact api names.
If you get an error due to Integer decimal thing using Integer.valueOF, then you need to type cast like this below
for(Integer i = 1 ; i< Integer.valueOf(opplineitem.Term__c) ; i++){
Let me know if you have trouble implementing this.
Thank you very much. I did not expect such an answer so quickly.
I was trying to implement and test this in a playground. I created my Term Object and was trying to create the needed lookup field. After searching online I have discovered that a lookup to OpportunityProduct is not supported and many people are hoping for a change. With that lookup being central to this working this solution wont work.
Looking at your code, if that lookup were allowed, I think you nailed it. Again, thank you very much for your time.
Apologies from my end. Actually lookup field is not allowed , so this solution will not work and vf page cannot be embedded in opportunity Line item.
But we can add lightning component :
Controller JS
Apex Class
After adding the lightnig component it will look something like this below
Hope this helps!