Salesforce Tip: Filter Opportunity Product Dynamically During Selection

We came across a requirement to display only certain list of products dynamically for the user to select when adding a new opportunity line item.

First thought was to use different Pricebook, however, this is not possible as the customer has an integration to sync all the product price into Standard Price Book.

The workaround is to create a new list button for Opportunity Product object that redirects the user to the Salesforce standard “add opportunity product” screen but with some predefined filter value. For example:

 

/p/opp/SelectSearch?addTo={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}&PricebookEntrycol0=PRODUCT2.FAMILY_ENUM&PricebookEntryoper0=e&PricebookEntryfval0={!Opportunity.Type}

 

The new button will need to be added to the Opportunity page layout in the Opportunity Product related list.

opp_product_auto