We are capturing a few custom fields at product level and wanted to use them in some calculation. The result of the calculation needs appear on Opportunity custom fields.
Let us say, the product has field1 and field2 custom fields..I wanted to multiply these fields first and summarize this value for all products and update on opportunity(kind of rollup)
Example formula: SUM of all products(field1 * field2).
Having said that, I tried with workflow field update..I was able to get the custom field in workflow field update on OpportunityLineitem but I don't know how to to aggregate this for all products.
I was thinking trigger is the only option for this and here is the approach.
- Create a trigger on OpportunityLineitem which gets fired anytime a product added to Opportunity
- In the trigger do calculation based on the product custom fields and aggregate the value for all line items.
- Update opportunity.
Before moving forward, I wanted to make sure I am in the right direction OR it could be achieved with out a trigger using workflow field update or any other means.
Appreciate your feedback.