0

I have tried to figure out if there is a way to calculate the sum of specific products from opportunity products and display it in the opportunity object, but I haven't been very successful with that. Is that even possible? Will a trigger do the job?

Example:

Opportunity-LineItem

Product A (total price: $1.00)

Product B (total price: $2.00)

Product C (total price: $3.00)

Product D (total price: $4.00)

Field in the opportunity object:

  • Product A&D: $5.00
  • Product B&D: $6.00
  • Product A&B: $3.00
  • Product C&D: $7.00
  • Product C&B: $5.00
  • I'd think you would be able to take care of this using a couple of rollup summary fields (RSF for short). Have you tried adding a filter to a RSF to control which OpportunityLineItems get included in that RSF? – Derek F Sep 8 '17 at 20:44
  • You need to use trigger for this calculation – Santanu Boral Sep 8 '17 at 21:38
0

Assuming only five combos, then 5 RSF fields will do the trick

  • You will need to have a workflow copy the value of OpportunityLineItem.PricebookEntry.Product.ProductCode into a new custom field OpportunityLineItem.ProductCode__c. This is because RSF criteria can't reference cross object fields. If the OLI contains the Product Code, then you can write the RSF criteria.
  • Create five formula Checkbox fields IsAD__c, IsBD__c, ... that are true if OpportunityLineItem.ProductCode__c = 'A' or = 'D', etc.
  • RSF criteria for Opportunity.AD__c is sum of OpportunityLineItem.TotalPrice if IsAD__c = true
  • Rinse and repeat for the other 4 combos

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy