You are here:
ProductDefinitionInterface
Updates, deletes, and adds line items in an Opportunity, Order, or Quote.
Type
Strongly typed
Triggered When
The ProductDefinitionInterface is triggered when a create, replace, update, or delete action is taken in the Opportunity Manager, Order Manager, or Quote Manager. It is not triggered in the review cart.
Called In
The handleAction method calls the ProductDefinitionInterface. The following is one possible data flow when a Product is deleted from the cart:
-
deleteProductFromCart (ProductConfigurationController)
-
handleLineItemAction (ProductLineItemEventHandler)
-
handleAction (DefaultProductDefinitionImplementation)
-
deleteProduct
-
priceLineItems
-
priceLineItems (DefaultPriceImplementation)
-
getCartsItems
The following is one possible data flow when a Product is added to the cart:
-
addProductToCart (ProductConfigurationController)
-
handleLineItemAction (ProductLineItemEventHandler)
-
handleAction (DefaultProductDefinitionImplementation)
-
addLineItems
-
getProductHierarchy
-
priceLineItems
-
priceLineItems (DefaultPriceImplementation)
-
getCartsItems
The following is one possible data flow when a Product is configured from the Product list:
-
getContextProductHierarchy (ProductConfigurationController)
-
handleLineItemAction (ProductLineItemEventHandler)
-
handleAction (DefaultProductDefinitionImplementation)
-
getProductHierarchy
The following is one possible data flow when a Product is configured from the cart:
-
configureProductFromCart (ProductConfigurationController)
-
handleLineItemAction (ProductLineItemEventHandler)
-
handleAction (DefaultProductDefinitionImplementation)
-
configureCart
-
savePostConfigure (after making changes, user clicks the Save button)
-
getCartsItems
Signature
Access |
Signature |
|---|---|
global |
|
Default Implementation
The DefaultProductDefinitionImplementationDefaultProductDefinitionImplementation is used for all update, delete, and add line item actions for Opportunity, Order, and Quote.
Other Implementations
None
Input Parameters
productLineItemActionParam
Input parameters based on PriceBookEntry ID, LineItemID, action, and other internal parameters
Output Parameters
outputMap
Type: Map <String, Object>
List of items added or merged
Sample Implementation
global with sharing class DefaultProductDefinitionImplementation implements GlobalInterfaces.ProductDefinitionInterface {
SObject parentItem {
get;
set;
}
SobjectType parentObjectTypeForPage;
SObjectType lineItemTypeForPage = null;
ProductLineItemActionParam productLineItemActionParam;
Map<String, Object> outputMap;
Id lnItemId {
get;
set;
}
Map<Id, List<Id>> parentProductToChildProds = new Map<Id, List<Id>> ();
Map<String, ProductChildItem_c> parentChildToProductChildItemMap = new Map<String, ProductChildItem_c> ();
Map<Id, Map<String, Object>> offerProdIdToInfoMap = new Map<Id, Map<String, Object>> ();
/**
@description Entry method of interface. Decides which of 5 operations to call.<br>
All these methods take no parameters and return void. They operate on the variables within the class<br>
- addLineItems()<br>
- deleteProduct()<br>
- updateQuantityInCart()<br>
- configureCart()<br>
- savePostConfigure()<br>
@param productLineItemActionParam (ProductLineItemActionParam)
@param outputMap (Map<String, Object>)
@return void
*/
global void handleAction(ProductLineItemActionParam productLineItemActionParam, Map<String, Object> outputMap) {
Logger.err('Inside New handleAction of DefaultProductDefinitionImplementation');
this.productLineItemActionParam = productLineItemActionParam;
this.outputMap = outputMap;
if (productLineItemActionParam.action.equalsIgnoreCase('AddLineItems')) {
addLineItems();
} else if (productLineItemActionParam.action.equalsIgnoreCase('Delete')) {
deleteProduct();
} else if (productLineItemActionParam.action.equalsIgnoreCase('UpdateQuantityInCart')) {
updateQuantityInCart();
} else if (productLineItemActionParam.action.equalsIgnoreCase('ConfigureCart')) {
configureCart();
} else if (productLineItemActionParam.action.equalsIgnoreCase('SavePostConfigure')) {
savePostConfigure();
} else if (productLineItemActionParam.action.equalsIgnoreCase('implicitSaveProduct')) {
implicitSaveProduct();
} else if (productLineItemActionParam.action.equalsIgnoreCase('getProductHierarchy')) {
getProductHierarchy();
}
}
The DefaultProductDefinitionImplementation is more than 750 lines long. For the complete implementation, see the DefaultProductDefinitionImplementation Apex class. For more information, see Explore ImplementationsExplore Implementations.

