Loading
Get Started with Communications, Media, and Energy & Utilities (CME)...
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          PricingMatrixCalculationService

          PricingMatrixCalculationService

          Invoke calculation procedures. It is the default service that OmniScript uses for calculation actions. You can also use it as part of any Apex class in which you want to call a pricing calculation.

          Interface

          VlocityOpenInterface

          Input Parameters

          configurationName

          Procedure name used to find the current active procedure version with the highest priority.

          mode

          Simulate or Null

          Simulate does not execute the database operation.

          configurationversionId

          Procedure version ID—use this version of the procedure if this parameter is passed.

          effectiveDate

          The date to find the active procedure version. If it is not passed in, Now() is used. Example: options.put('effectiveDate','2018-10-31 23:09:10');

          sourceObjectIds

          A list of IDs existing in the Salesforce database. If sourceObjectIds are specified, the input Omnistudio Data Mapper bundle ID is needed to map the database data to the matrix lookup input data.

          includeInputs

          Echoes the inputs to be included in output, for example, Yes.

          outputKey

          The service output wrapper, if specified. If not specified, the service output is wrapped inside output.

          aggregateByListName and mergeInListName

          If these two parameters are specified, the two lists are merged. Each element in a list of mergeInListName merges with each list of aggregateByListName, for example,

          options.put('aggregateByListName', 'ProductList');
          options.put('mergeInListName', 'UserInputList');

          matchInputVariables

          If true, the service checks whether the input data has all of the input variables. If any are missing, the service throws the Missing Input Variable Exception. If false, there is not an additional check.

          Sample Code

          global with Sharing class UsePricingMatrix {
             public static Map < String, Object > getPriceFromMatrix() {
                Map < String, Object > inputMap = new Map < String, Object > ();
                Map < String, Object > options = new Map < String, Object > ();
                options.put('configurationName', 'ProductPrice');
                options.put('includeInputs', true);
                Map < String, Object > dataMap1 = new Map < String, Object > ();
                dataMap1.put('Age', 27);
                dataMap1.put('Smoker', false);
                dataMap1.put('ID', '1234');
                Map < String, Object > dataMap3 = new Map < String, Object > ();
                dataMap3.put('Age', 29);
                dataMap3.put('Smoker', true);
                dataMap3.put('ID', '5678');
                Object[] inputdata = new List < Object > ();
                inputdata.add(dataMap1);
                inputdata.add(dataMap3);
                Map < String, Object > c = new Map < String, Object > ();
                inputMap.put('UserInputList', inputdata);
                List < Object > productList = new List < Object > ();
                Map < String, Object > prod1 = new Map < String, Object > ();
                prod1.put('Product', 'PPO200');
                Map < String, Object > prod2 = new Map < String, Object > ();
                prod2.put('Product', 'PPO300');
                productList.add(prod1);
                productList.add(prod2);
                inputMap.put('ProductList', productList);
                options.put('verbose', false);
                options.put('aggregateByListName', 'ProductList');
                options.put('mergeInListName', 'UserInputList');
                Map < String, Object > output = new Map < String, Object > ();
                Type t = Type.forName('vlocity_ins','PricingMatrixCalculationService');
                vlocity_ins.VlocityOpenInterface vpsi = (vlocity_ins.VlocityOpenInterface) t.newInstance();
                vpsi.invokeMethod('calculate', inputMap, output, options);
                return output;
             }
          }

          Related Implementations

          None

           
          Loading
          Salesforce Help | Article