You are here:
XLIEligibilityValidationService
Invoke eligibility rules to validate line items in the input list (parentList) of opportunities, orders, and quotes.
Interface
VlocityOpenInterface
Input Parameters
methodName
Not currently used
parentList
The key of the list of parent objects in the inputMap. The parent
object may be Opportunity, Order, or Quote.
inputType
The sObject to be validated—Opportunity, Order, or Quote
Output Parameters
Validation_Results
The validation result key in outMap. Validation contains a map of
the parent ID from the input parentList with the
XLIItemValidationResults.
XLIValidationResults
The validation results for each item in the parentList.
Sample Code
public with sharing class XLIEligibilityValidationService extends XLIValidationServiceBase implements VlocityOpenInterface {
public Boolean invokeMethod(String methodName, Map<String, Object> inputMap, Map<String, Object> outMap, Map<String, Object> options) {
Map<String, Object> validationOutputMap = executeValidation(inputMap);
XLIValidationResults validationResults = processValidationResults(inputMap, validationOutputMap);
outMap.put(XLIValidationResults.KEY_VALIDATION_RESULTS, validationResults);
return true;
}
/*
protected Map<String,Object> executeValidation(Map<String,Object>inputMap) {
List<SObject> parentList = (List<SObject>)inputMap.get('parentList');
Logger.dbg('XLIValidationServiceBase.executeValidation().parentList='+parentList);
if ( parentList==null || parentList.isEmpty() ) {
return new Map<String,Object>();
}
List<SObject> lineItemsToValidate = getLineItemsToValidate(parentList);
Map<Id, ItemWrapper> pricebookIdToItemWrapper = new Map<Id, ItemWrapper>();
for(integer index = 0; index < retval.size(); index++){
pricebookIdToItemWrapper.put(retval[index].Id, new ItemWrapper(retval[index]));
}
FlowStaticMap.flowMap.put('itemList',parentList);
FlowStaticMap.flowMap.put('parentObjectList',parentList);
FlowStaticMap.flowMap.put('childItemsList',lineItemsToValidate);
FlowStaticMap.flowMap.put('pricebookIdToItemWrapper', pricebookIdToItemWrapper);
Map<String, Object> myMap = new Map<String, Object>();
myFlow = new Flow.Interview.EligibilityRulesFlow(myMap);
try {
myFlow.start();
Map<Id, ItemWrapper> pbMap = (Map<Id, ItemWrapper>)FlowStaticMap.flowMap.get('pricebookIdToItemWrapper');
List<ItemWrapper> pbWrappers = pbMap.values();
List<PriceBookEntry> filteredPricebookEntries = new List<PriceBookEntry>();
for(Integer index = 0; index < pbWrappers.size(); index++){
if(pbWrappers[index].isQualified == false)continue;
filteredPricebookEntries.add((PricebookEntry)pbWrappers[index].itemSObject);
}
return filteredPricebookEntries;
} catch (System.FlowException e){
System.debug(LoggingLevel.ERROR,'exception::::' + e);
return null;
}
}
*/
protected override List < Id > getRuleIds() {
List<Id> ruleIds = new List<Id> ();
String query = 'SELECT Id FROM Rule_c WHERE Typec IN (\'Eligibility\') AND ObjectName_c=\''
childObjectType '\'';
Logger.dbg('XLIEligibilityValidationService.getRuleIds().RuleQuery=' + query);
Rule__c[] rules = Database.query(query);
for (Rule__c rule: rules) {
ruleIds.add(rule.Id);
}
return ruleIds;
}
}
Related Implementations
-
XLIAvailabilityValidationServiceXLIAvailabilityValidationService
-
XLIBatchValidationConfiguration
-
XLIBatchValidationNotificationXLIBatchValidationNotification
-
XLIConfigurationValidationServiceXLIConfigurationValidationService
-
XLIMergeServiceXLIMergeService
-
XLIPricingValidationServiceXLIPricingValidationService
