You need to sign in to do that
Don't have an account?
supriya jain 27
How can we Add product based on filters on Opportunity in lightning environment
I want to display Products records with some filter conditon, when I click on Add product on Opportunities.
I have achieved it using custom vf page and URL parameters,it is working fine in Classic but this is not working in Lightning.It redirects to Classic Add product page and again after adding it navigates back to lighning. Do anyone know the work around for this So that it remains in lighning environment even at the time of adding products?
I have achieved it using custom vf page and URL parameters,it is working fine in Classic but this is not working in Lightning.It redirects to Classic Add product page and again after adding it navigates back to lighning. Do anyone know the work around for this So that it remains in lighning environment even at the time of adding products?
A similar question was discussed here
I recommend overriding the 'Add Products' button with a Visualforce page and surface the lighting component inside the VF page to check if it remains in a lightning environment
Step 1: Create a lightning component with your custom logic (filter conditions)
Step 2: Create a lightning Application
Step 3: Then create a VF Page
Navigate to Opportunity Products object, go to the buttons sections, and select the Add Products button and edit and override with the above VF Page
Let me know if it works with lightning out
If you find this information helpful, please mark this answer as Best. It may help others in the community. Thank You!
Anudeep
Thanks for the reply.
I am using a custom vf page on Opportunity Detail page, but Add product button is standard only , we just used the filters (So product are dispayed based on certain contions instead of all Products) to navigate to Add Product URL.
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';
}
}
function redirectEditAll(){
window.top.location.href = '/oppitm/multilineitem.jsp?oppId={!$CurrentPage.parameters.Id}&retURL=%2F{!$CurrentPage.parameters.Id}';
}
function redirectChoosePriceBook(){
window.top.location.href = '/oppitm/choosepricebook.jsp?id={!$CurrentPage.parameters.Id}&retURL=%2F{!$CurrentPage.parameters.Id}&saveURL=%{!$CurrentPage.parameters.Id}';
}
</script>
This vf is successfully visible in Lightning experience, the only problem I am facing is with Add Product URL, it If I get the URL suggesstion for lightning UI, I can use that URL in lightning component navigation.