1private void calculatePostInvoke(Map<String, Object> input,Map<String, Object> output)
2{
3 System.debug('debug post invoke');
4 Map<String, Object> pricingVariableCodeToValueMap = (Map<String,Object>)input.get('pricingVariableCodeValueMap');
5 System.debug('post invoke price data: '+json.serialize(pricingVariableCodeToValueMap));
6 //Getting the cart document instance
7 vlocity_digital.CpqCartDocument cart = (vlocity_digital.CpqCartDocument)input.get('cartDocument');
8 //method to get all the line items
9 Map<String, Object> outputMap = cart.call('getAllItems', new Map<String, Object>{'hierarchyLevel'=>-1});
10 Map<String, vlocity_digital.CpqCartDocumentItem> allItemsMap = (Map<String, vlocity_digital.CpqCartDocumentItem>) outputMap.get('result');
11 String currentItemId = (String)input.get('itemId');
12 System.debug('debug currentItemId:'+currentItemId);
13 //Getting the cartDocumentItem having id as currentItemId
14 vlocity_digital.CpqCartDocumentItem currentItem = allItemsMap.get(currentItemId);
15 System.debug('debug post output: '+json.serialize(output));
16 //getting the line item fields
17 Map<String, Object> testOTMap = currentItem.call('getItemField', new Map<String, Object>{'field'=>'vlocity_digital__OneTimeCharge__c'});
18 System.debug('debug post otc from cartdoc : '+json.serialize(testOTMap));
19}