Trigger pricing plan to run pricing without inserting cart or line items:

  • string parameter pricingPlanName is required and its expected to contain Pricing Plan code
  • map parameter cart is an equivalent of either Quote or Order sObjects: vlocity_cmt__PriceListId__c is mandatory, other fields are optional, specify them if they are required for pricing
  • list parameter items represents line items: vlocity_cmt__LineNumber__c, Product2.ProductCode and vlocity_cmt__AttributeSelectedValues__c are required

Code Example

sfix.DebugLogger.setLog(true);
Map<String,Object> cart = new Map<String,Object>{'vlocity_cmt__PriceListId__c'=>'a47BS00000007RJYAY', 'Opportunity.Sales_Team_Group__c'=>null};

List<Map<String,Object>> items = new List<Map<String,Object>>{
	new Map<String,Object>{ 'vlocity_cmt__LineNumber__c'=>'0001', 'Product2.ProductCode'=>'C_ADD_ONSEC_AWARENESS_COURSE', 'vlocity_cmt__AttributeSelectedValues__c'=>'{"ATT_SERV_PKG":"Topping 1 Course"}' },
	new Map<String,Object>{ 'vlocity_cmt__LineNumber__c'=>'0002', 'Product2.ProductCode'=>'C_B_SELLING', 'vlocity_cmt__AttributeSelectedValues__c'=>'{"ATT_TEST_BANDWIDTH":"100", "ATT_TEST_CONTRACT":"48"}' }
};

Map<String,Object> input = new Map<String,Object>{'pricingPlanName'=>'REPRICING_PLAN', 'cart'=>cart, 'items'=>items, 'fields'=>'PricebookEntry.Product2.Pricing_Model__c'};
Map<String,Object> output = new Map<String,Object>();

Callable sph = new sfix.StatelessPricing();
try{

	sph.call( 'runPricingPlan', new Map<String,Object>{'input'=>input, 'output'=>output} );

} catch ( Exception e ) {
	System.debug( '🌼 cause: ' + e.getCause() );
	System.debug( '🌼 message: ' + e.getMessage() );
	System.debug( '🌼 line number: ' + e.getLineNumber() );
	System.debug( '🌼 stack trace \n' + e.getStackTraceString() );
}
SfixLogWrapper.printDebugLog();
System.debug('😎 ' + JSON.serialize(output));