You are here:
ProductAvailabilityInterface
The ProductAvailabilityInterface returns a filtered list of available products, usually based on the geographical address for an account.
Type
Strongly typed
Triggered When
The ProductAvailabilityInterface is triggered when the customer begins the product selection process.
Called In
The getProducts method in OrderManagement calls the ProductAvailabilityInterface.
The ProductConfigurationController checks if the CPQ Configuration Setup custom setting includeineligible is True. If the custom setting does not exist or is False, the ProductConfigurationController calls the ProductListUtility.getProducts method. The ProductListUtility.getProducts method gets the implementation associated with the ProductAvailabilityInterface and calls getAvailableProducts on the implementation.
If the includeineligible custom setting is true, the ProductConfigurationController follows the calling class path in the AvailabilityRulesFlowOpenImplementation.
The following is the data flow for availability and eligibility:
-
AdvProductSearchController
-
ProductListUtility.getProducts
-
ProductAvailabilityInterface
-
getAvailableProducts
-
ProductEligibilityInterface
-
getEligibleProducts
Signature
Access |
Signature |
|---|---|
global |
|
Default Implementation
The DefaultProductAvailabilityImplementationDefaultProductAvailabilityImplementation returns input as output, without modification.
Other Implementations
-
The AvailabilityRulesFlowImplementationAvailabilityRulesFlowImplementation runs the active Availability Rules that are defined in the Availability Rules flow.
-
The FilterAvailabilityImplementationFilterAvailabilityImplementation runs all active availability rules for the opportunity, order, or quote.
-
The LocaleProductAvailabilityLocaleProductAvailability implementation looks up all line items the shipping postal code and state. It checks the Products Not Available related list entries for the postal code and state against each product in the price book.
Input Parameters
item
Required
Type: sObject
The parent object—Opportunity, Order, or Quote. The shipping address may be used for locale information.
retval
Required
Type: List<PriceBookEntry> retval
List of price book entries to evaluate
Output Parameters
List
Type: List<PriceBookEntry>
Filtered list of qualified price book entries
Sample Implementation
global with sharing class DefaultProductAvailabilityImplementation implements GlobalInterfaces.ProductAvailabilityInterface
{
global List<PriceBookEntry> getAvailableProducts(SObject item, List<PriceBookEntry> retval)
{
if(retval == null || (retval != null && retval.size() == 0))
{
retval = new List<PriceBookEntry>();
try
{
Id itemId = (Id)item.get('Pricebook2Id');
retval = [SELECT
Id,
Pricebook2Id,
Product2Id,
ProductCode,
Product2.Type__c,
Product2.SubType__c,
Product2.Description,
UnitPrice,
Name,
Product2.Name,
Product2.JSONAttribute__c,
RecurringPrice__c,
IsActive
FROM
PricebookEntry
WHERE
Pricebook2Id = : itemId AND (Product2.recordTypeId = null OR Product2.recordType.DeveloperName = 'Product')];
}
catch(Exception e)
{
throw e;
}
}
return retval;
}
}

