+ Start a Discussion
Geo NoGeo No 

Roll Up summary field fom products to opportunity

I'm just an admin, not a dev (yet). I would like to create a roll up field at the opportunity taht will be the summ of the product meeting a certain criteria. When I create a rollup summary field at the opportunity level, I can filter the criterias, but not the one I am interested in: Product Name.
How can I filter the product name in this field?
Many thanks!
Try creating a formula field with this expression PriceBookEntry.Product2.name on Opportunity Line Item and use that field in the rollup.
Unfortunately rollup filters do not allow you to do so by formula field. Your best bet is to create a text field on the Opportunity Product object, then create a workflow to update the text field to the formula showed above (
PriceBookEntry.Product2.Name). After, you will need to do a mass update on all existing Opportunity Products to get this field populated. (note, if you are in an org that changes the names of existing products, this will cause some disconnect between the new name and existing related opportunity products).

So steps:

1) Create new text field on opportunity product (Product_Name__c)

2) Create workflow on opportunity product
every time record is updated or created
Product_Name__c <> PriceBookEntry.Product2.Name

Perform field update Product_Name__c to formula PriceBookEntry.Product2.Name

3) You can do a mass update in dataloader, or run this in command console till 0 rows are updated.

list<OpportunityLineItem> ol = new list<OpportunityLineItem>();
for(OpportunityLineItem o: [Select Product_Name__c, PriceBookEntry.Product2.Name from OpportunityLineItem where Product_Name__c != PriceBookEntry.Product2.Name LIMIT 100]){
o.Product_Name__c = o.PriceBookEntry.Product2.Name;
update ol;