I have created a formula field that displays an image if a product has gone "End Of Life" this is based on a date field that is managed on the Product Object.

This is also displayed on the Opportunity Product both in the compact view and on the page and related list on the Opportunity.

I want to display this image on the Opportunity, if even one of the Opportunity Products is displaying this EOL image.


What you want is a RSF on Opportunity Opportunity_Product_Expired_Count__c that counts the OpportunityLineItem where the associated Product2 is end of life.

Because you can't do RSF on cross object formula fields you are faced with coercing a custom field value in OpportunityLineItem, let's call it Is_End_of_Life__c whenever a Product2 goes End of Life. This becomes the basis for the RSF.

Thus, you will need a trigger on Product2 that then mass updates all child OpportunityLineItems to set this field to true. This may require setting off a batch job as there could be tens of thousands of affected OpportunityLineItem children.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.