You are here:
ValidationRulesFlowImplementation
Run the active compatibility rules that are defined in the Validation Rules flow. The flow includes rule actions that invoke compatibility rules. The ValidationRulesFlowImplementation and the Validation Rules flow are included in the managed package.
Compatibility rules determine whether products in the cart are compatible with, require, or exclude other products.
Interface
ProductValidationInterfaceProductValidationInterface
Sample Code
global with sharing class ValidationRulesFlowImplementation implements vlocity_cmt.GlobalInterfaces.ProductValidationInterface
{
global Flow.Interview.ValidationRulesFlow myFlow
{
get;set;
}
global void validateLineItems(List<vlocity_cmt.ItemWrapper> itemsList)
{
List<SObject> itemList = new List<SObject>();
Map<Id, vlocity_cmt.ItemWrapper> masterObjectIdToItemWrapper = new Map<Id, vlocity_cmt.ItemWrapper>();
for(vlocity_cmt.ItemWrapper item: itemsList)
{
itemList.add(item.itemSObject);
masterObjectIdToItemWrapper.put(item.itemSObject.Id, item);
}
// Set up the parameters required in the flow
vlocity_cmt.FlowStaticMap.flowMap.put('itemList', itemList);
vlocity_cmt.FlowStaticMap.flowMap.put('parentObjectList', itemList);
vlocity_cmt.FlowStaticMap.flowMap.put('childItemsList', itemsList);
vlocity_cmt.FlowStaticMap.flowMap.put('masterObjectIdToItemWrapper', masterObjectIdToItemWrapper);
Map<string, object> myMap = new Map<string, object>();
myFlow = new Flow.Interview.ValidationRulesFlow(myMap);
try
{
myFlow.start();
}
catch(System.FlowException e)
{
System.debug(LoggingLevel.ERROR, 'exception::::' + e);
}
}
}Related Implementations
-
DefaultProductValidationImplementationDefaultProductValidationImplementation
-
ValidationRulesImplementationValidationRulesImplementation

