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
          ProductEligibilityOpenInterface

          ProductEligibilityOpenInterface

          The ProductEligibilityOpenInterface returns the items in the product list with a qualification flag and a message for each disqualified item. The interface accepts the header object and a list of price book entries and returns a list of item wrappers.

          Type

          Loosely typed

          Triggered When

          The ProductEligibilityOpenInterface is triggered when presenting a list of products in the Opportunity Manager, Order Manager, Quote Manager, or Vlocity Cart.

          Called In

          The getProducts method in OrderManagement calls the ProductEligibilityOpenInterface.

          The ProductConfigurationController checks if the includeineligible custom setting is True. If True, it calls the ProductListUtility.getAllEligibilityProducts method. The ProductListUtility.getAllEligibilityProducts method gets the implementation associated with the ProductEligibilityOpenInterface and calls the getAllEligibilityProducts method on the implementation.

          The following is the data flow for availability and eligibility:

          1. AdvProductSearchController

          2. ProductListUtility.getProducts

          3. ProductAvailabilityInterface

          4. getAvailableProducts

          5. ProductEligibilityInterface

          6. getEligibleProducts

          Signature

          Access

          Signature

          global

          Boolean invokeMethod(String methodName, Map<String,Object> input, Map<String,Object> output, Map<String,Object> options)

          Default Implementation

          The DefaultEligibilityOpenImplementationDefaultEligibilityOpenImplementation wraps the input price book entries in an ItemWrapper list and returns the output without modification, using the parameter outputMap.

          Other Implementations

          The EligibilityFlowOpenImplementationEligibilityFlowOpenImplementation uses the Eligibility Rules flow, which executes defined eligibility rules.

          Input Parameters

          methodName

          Required

          Type: String

          The name of the method to execute, for example, getAllEligibleProducts

          input

          Required

          Type: Map<String, Object>

          The input map includes the following:

          • parentItem

            Type: sObject

            The parent context header item¬—Opportunity, Order, or Quote

          • pricebookEntryList

            Type: List<PricebookEntry>

            List of price book entries

          output

          Required

          Type: Map<String, Object>

          The output map contains the parameter itemWrapperList of type List<ItemWrapper>, which is a list of Price Book Entry objects where the isQualified flag is set and the errors string list is populated for disqualified items.

          options

          Required

          Type: Map<String, Object>

          Null

          Output Parameters

          None

          Sample Implementation

          Note
          Note

          The following code does not include a namespace. You must change any referenced package component to refer to the appropriate namespace.

          global with sharing class SampleEligibilityOpenImplementation implements VlocityOpenInterface
          {
             global Boolean invokeMethod(string methodName, Map<string, object> inputMap, Map<string, object> outputMap, Map<string, object> options)
             {
                Boolean success = true;
                try
                {
                   if(methodName == 'getAllEligibilityProducts')
                   {
                      doEligibility(inputMap, outputMap);
                   }
                }
                catch(Exception e)
                {
                   success = false;
                   outputMap.put('error', e.getMessage());
                   outputMap.put('itemWrapperList', new  List<ItemWrapper>());
                }
                return success;
             }
             private void doEligibility(Map<string, object> inputMap, Map<string, object> outputMap)
             {
                SObject item = (SObject)inputMap.get('parentItem');
                List<PriceBookEntry> pricebookEntryList = (List<PricebookEntry>)inputMap.get('pricebookEntryList');
                List<ItemWrapper> result = new  List<ItemWrapper>();
                for(Integer index = 0; index < pricebookEntryList.size(); index++)
                {
                   // Wrap the price book entry with an ItemWrapper
                   ItemWrapper wrapper = new  ItemWrapper(pricebookEntryList[index]);
                   result.add(wrapper);
                   // Uncomment the commented lines below to see the test eligibility message appear in the UI. isQualified = false means not eligible.
                   // wrapper.isQualified = false;
                   // wrapper.errors = new List<String>{'This is a test eligibility message. This item is not eligible.'};
                }
                // Return the list of ItemWrappers in the output
                outputMap.put('itemWrapperList', result);
             }
          }
           
          Loading
          Salesforce Help | Article