You need to sign in to do that
Don't have an account?
Zain Butt
Create Opportunity Amount field Trigger to Roll-up from Opportunity Products
I'm tasked with creating an Opportunity Amount field Trigger to Roll-Up from Opportunity Products. How would I go about creating this trigger to roll up from Opportunity Products? Sample code would be awesome!
Sincerely,
Junior Developer!
Sincerely,
Junior Developer!
Write a trigger on Opportunity Product (after insert, after update) which will count amount of all products associated with Opportunity record. Add the amount and update parent Opportunity record.
Get Opportunity Id from incoming Oppty Product. Extract all Oppty product associated with Opportunity using SOQL. In FOR LOOP, calculate Total Amount and Update Opty field with Total amount.
It will be a few lines of code. Try it yourself. This way you will learn more.
Best of Luck!!!
-Thanks,
TK
All Answers
Write a trigger on Opportunity Product (after insert, after update) which will count amount of all products associated with Opportunity record. Add the amount and update parent Opportunity record.
Get Opportunity Id from incoming Oppty Product. Extract all Oppty product associated with Opportunity using SOQL. In FOR LOOP, calculate Total Amount and Update Opty field with Total amount.
It will be a few lines of code. Try it yourself. This way you will learn more.
Best of Luck!!!
-Thanks,
TK
It's a standard functionality provided by salesforce. Amount field on opportunity will be rolled up from opportunity products. if need any support please reach me.
Thanks
Madhu
+91-9940589878