You are here:
RuleSupport
Run a set of rules against a set of objects. These objects are defined in the flowMap parameter.
Interface
VlocityOpenInterface
Input Parameters
methodName
Required
Type: String
The name of the method to execute, for example, executeRules
input
Required
Type: Map<String, Object>
Input maps include the following:
-
ruleIdentifierType
Type: String
The field name that identifies the rules to run
-
ruleIdentifiersList
Type: List<Object>
The list of identifier values
In addition, each type of rule must have different values in the flowMap parameter of the input map.
Compatibility rules require the following:
-
itemList
Type: List<sObject>
The list of sObjects to validate. This parameter is not nillable.
-
masterObjectIdToItemWrapper
Type: Map<Id,ItemWrapper>
The sObject ID to wrap. This parameter is not nillable.
Availability and eligibility rules require the following:
-
itemList
Type: List<sObject>
The list of sObjects to evaluate for availability or eligibility, List<sObject>. This parameter is not nillable.
-
pricebookIdToItemWrapper
Type: Map<Id,ItemWrapper>
The price book ID to wrap. This parameter is not nillable.
Pricing rules require the itemList parameter, a list of sObjects to evaluate for availability or eligibility, List<sObject>. This parameter is not nillable.
output
Required
Type: Map<String,Object>
The output contains the following:
-
filterIdToObjectIds
-
filterIdToEvaluation
-
filterIdToFilter
-
sObjectIdTosObject
-
sObjectIdToItemWrapper
-
objectIdToFilterEvaluation
None of these items is nillable.
options
Required
Type: Map<String, Object>
Null
Sample Code
//The RuleSupport class can invoke the Rules using this sample syntax
//The elements in the FlowStaticMap will be different based on the rule type
//Please see description of input listed above
//The following describes the input in the case of an Eligibility/Availability rule
//It assumes the presence of the following variables
//#item : the header sobject(Opportunity/Quote/Order),
//#pricebookIdToItemWrapper : price book Id to item wrapper map,
//#ruleIds : the Ids of the rules to run. the rules must be of the same type.
FlowStaticMap.flowMap.put('itemList',new list<Sobject>{item});
FlowStaticMap.flowMap.put('pricebookIdToItemWrapper', pricebookIdToItemWrapper);
Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
input.put('ruleIdentifierType', 'Id');
input.put('ruleIdentifiersList', ruleIds);
input.put('flowMap', FlowStaticMap.flowMap);
RuleSupport ruleSupport = new RuleSupport();
RuleSupport.invokeMethod('executeRules',input, output, null);
Related Implementations
None

