3 things to be handled before customizing the Opportunity Product Addition
1)Choose Price Book
2)Search Product Book
3)Adding the Line Items(Multi Line Page)
As since this is an out of box feature and all of the above are linked, we cannot customize any of the above individually.
Following are the relations that exist b/w corresponding objects
Opportunity <- Opportunity Line Item (opportunityId)
Opportunity -> PriceBook2(PriceBook2Id)
Opportunity Line Item -> PriceBookEntry(PriceBookEntryId )
PriceBookEntry -> PriceBook2
PriceBookEntry -> Product2
Choose Price BookIf the organisation doesn't have many product books then we do not need the choose product book from the Opportunity Product Related List. We can set the default Product Books entry using a trigger by updating the Opportunity Field PriceBook2Id .
But if the Organisation do have multiple Product Books then we have customize this feature too by replacing the standard Choose Price Book button with a custom button and redirecting to VFP.
Note : Once a ProductBook is assigned to a opportunity we cannot assign product belongs to another productbook, if we try to do that all the existing products will get deleted.
Search Product BookIn order to customize this we need to override the Add Product button in the Opportunity Line Item related list with a VFP having standard controller to Opportunity. User can have his own custom search based on some criteria on Product object and can retrieve the records from ProductBookEntry . While retrieving we also need to use the Opportunity Currency as we will have multiple entries for a single product. The searched records will be displayed in adjacent to a select check box so as to facilitate to choose few or all products. Once the user selects the products and click on some navigation button he should be redirected to the Multi Line Layout with the corresponding product details and will be again an VFP and the redirection should be a partial so as to maintain the previous pages information.
Note : Its better to use same controller for Search and Multi pages so the selection done in search page will be carried out to multi line with out an extra effort.
Multi Line Page : The selections that are made in Search page consists of the PriceBookEntry Id's using the details of which user need to create instances of Opportunity Line Items. When all the mandatory info is feeded and the save button is clicked the records will get saved and redirected to the Opportunity Detail page. We can add few more button such as Save & More, Cancel
2)Search Product Book
3)Adding the Line Items(Multi Line Page)
As since this is an out of box feature and all of the above are linked, we cannot customize any of the above individually.
Following are the relations that exist b/w corresponding objects
Opportunity <- Opportunity Line Item (opportunityId)
Opportunity -> PriceBook2(PriceBook2Id)
Opportunity Line Item -> PriceBookEntry(PriceBookEntryId )
PriceBookEntry -> PriceBook2
PriceBookEntry -> Product2
Choose Price BookIf the organisation doesn't have many product books then we do not need the choose product book from the Opportunity Product Related List. We can set the default Product Books entry using a trigger by updating the Opportunity Field PriceBook2Id .
But if the Organisation do have multiple Product Books then we have customize this feature too by replacing the standard Choose Price Book button with a custom button and redirecting to VFP.
Note : Once a ProductBook is assigned to a opportunity we cannot assign product belongs to another productbook, if we try to do that all the existing products will get deleted.
Search Product BookIn order to customize this we need to override the Add Product button in the Opportunity Line Item related list with a VFP having standard controller to Opportunity. User can have his own custom search based on some criteria on Product object and can retrieve the records from ProductBookEntry . While retrieving we also need to use the Opportunity Currency as we will have multiple entries for a single product. The searched records will be displayed in adjacent to a select check box so as to facilitate to choose few or all products. Once the user selects the products and click on some navigation button he should be redirected to the Multi Line Layout with the corresponding product details and will be again an VFP and the redirection should be a partial so as to maintain the previous pages information.
Note : Its better to use same controller for Search and Multi pages so the selection done in search page will be carried out to multi line with out an extra effort.
Multi Line Page : The selections that are made in Search page consists of the PriceBookEntry Id's using the details of which user need to create instances of Opportunity Line Items. When all the mandatory info is feeded and the save button is clicked the records will get saved and redirected to the Opportunity Detail page. We can add few more button such as Save & More, Cancel
(This article is just to have basic idea on customizing the Add Product feature. Please let me know if you have any questions or I missed any thing. Thanks)