You are here:
PricingRulesImplementation
Runs all of the active rules for the line item type after running the default pricing implementation. The pricing rules include actions that could invoke classes or calculation procedures that set prices on line items of the parent sObject passed into the implementation.
Interface
PricingInterfacePricingInterface
Sample Code
global with sharing class PricingRulesImplementation implements vlocity_cmt.GlobalInterfaces.PricingInterface {
global void priceLineItems(SObject parent, List<SObject> itemList) {
if(itemList.isEmpty())return;
DefaultPricingImplementation defaultPricing = new DefaultPricingImplementation();
defaultPricing.priceLineItems(parent, itemList);
String objectName = String.valueOf(itemList[0].getSObjectType());
List<Id> ruleIds = new List<Id>();
for(Rule__c rule : [SELECT Id FROM Rule__c WHERE Type__c = 'Pricing' AND ObjectName__c =: objectName AND IsActive__c = true]){
ruleIds.add(rule.Id);
}
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('ruleIdentifiersList', new List<String>{'test rule'});
FlowStaticMap.flowMap.put('parent', parent);
FlowStaticMap.flowMap.put('itemList', itemList);
input.put('isTriggeredByFlow', false);
input.put('flowMap', FlowStaticMap.flowMap);
RuleSupport ruleSupport = new RuleSupport();
RuleSupport.invokeMethod('executeRules',input, output, null);
}
}
Related Implementations
DefaultPricingImplementationDefaultPricingImplementation

