You are here:
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:
-
AdvProductSearchController
-
ProductListUtility.getProducts
-
ProductAvailabilityInterface
-
getAvailableProducts
-
ProductEligibilityInterface
-
getEligibleProducts
Signature
Access |
Signature |
|---|---|
global |
|
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
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);
}
}

