Loading
Get Started with Communications, Media, and Energy & Utilities (CME)...
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          ProductDefinitionInterface

          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:

          1. deleteProductFromCart (ProductConfigurationController)

          2. handleLineItemAction (ProductLineItemEventHandler)

          3. handleAction (DefaultProductDefinitionImplementation)

          4. deleteProduct

          5. priceLineItems

          6. priceLineItems (DefaultPriceImplementation)

          7. getCartsItems

          The following is one possible data flow when a Product is added to the cart:

          1. addProductToCart (ProductConfigurationController)

          2. handleLineItemAction (ProductLineItemEventHandler)

          3. handleAction (DefaultProductDefinitionImplementation)

          4. addLineItems

          5. getProductHierarchy

          6. priceLineItems

          7. priceLineItems (DefaultPriceImplementation)

          8. getCartsItems

          The following is one possible data flow when a Product is configured from the Product list:

          1. getContextProductHierarchy (ProductConfigurationController)

          2. handleLineItemAction (ProductLineItemEventHandler)

          3. handleAction (DefaultProductDefinitionImplementation)

          4. getProductHierarchy

          The following is one possible data flow when a Product is configured from the cart:

          1. configureProductFromCart (ProductConfigurationController)

          2. handleLineItemAction (ProductLineItemEventHandler)

          3. handleAction (DefaultProductDefinitionImplementation)

          4. configureCart

          5. savePostConfigure (after making changes, user clicks the Save button)

          6. getCartsItems

          Signature

          Access

          Signature

          global

          void handleAction(ProductLineItemActionParam productLineItemActionParam, Map outputMap)

          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();
                }
             }
          Note
          Note

          The DefaultProductDefinitionImplementation is more than 750 lines long. For the complete implementation, see the DefaultProductDefinitionImplementation Apex class. For more information, see Explore ImplementationsExplore Implementations.

           
          Loading
          Salesforce Help | Article