You need to sign in to do that
Don't have an account?
Prakash@SFDC
Override "Add Products" button on Opportunity to display records with some filter condition
Hi ,
I want to display the records with some filter condition when i click Add Products button on Opportunity . How can i implement this ?
Thanks
Prakash
Hi Prakash,
When we try to add product to an opportunity - there is a set of filters you can apply to search for Products.
Are you saying that the Product list should be pre filtered whene you open the Add product page?
Yes Sonam , You are right . Is there any way to do that ?
Thanks
Prakash.
Hi Prakash,
As kiran explained in the post - you will have to create a custom button to implement the product filtering, create a vf page that popups whent he result with the button is clicked and replace this button with the add products button on the opportunity page layout - products related list
https://developer.salesforce.com/forums/?id=906F00000008p4XIAQ
https://sfdc-gyaan.rhcloud.com/tag/product/
<apex:pageBlock title="Opportunity Product Summary {!If(lockOpportunityProduct,'(Locked)','')}" id="ProductSummaryPageBlock" >
<!--Add Product redirects to Add Product standard page -->
<input type="button" class="custom-btn" value="Add Product" onclick="redirectAddProduct();" href="javascript:void(0)" style="user-select: auto;" />
</apex:pageBlockButtons>------
And Define function:
function redirectAddProduct(){
//Added for filtering Product based on Opportunity Record Type by supriya jain
if (confirm("Warning! Please click cancel and verify all the fields in Opportunity, otherwise you will get validation error whiling adding products!")) {
window.top.location.href = '/p/opp/SelectSearch?addTo={!$CurrentPage.parameters.Id}&retURL=%2F{!$CurrentPage.parameters.Id}&PricebookEntrycol0={!$Label.Knowles_Product_Division_Field_Id}&PricebookEntryoper0=e&PricebookEntryfval0={!productDivision}&PricebookEntrycol1=PRODUCT2.ACTIVE&PricebookEntryoper1=e&PricebookEntryfval1=true';
}
}