You are here:
InsProductService:getRatedProducts
Use this service to get an array of one or more products, priced using rating procedures attached to those products. This service also includes extra features such as tax and fee calculations, filtering, and performance optimization.
To use this service, pass it the set of inputs the rating procedure needs to price products. The service returns a filtered array of products and a result JSON from the rating procedure.
How It Works
-
The service searches Salesforce to retrieve a set of active products that fall within the effective start and end dates. See effectiveDate below for more information.
As part of the query, the services uses the criteria passed in the filter option to get an initial set of products. The data pulled from Salesforce includes the product’s eligibility rules and rating procedure, insured item specs, insured party specs, coverage specs, rating fact specs, and all its attributes.
-
Evaluates each product in the initial set based on its eligibility rules, further reducing the product set.
-
Searches the Input JSON for the
userInputskey and retrieves the key's value.userInputsis the set of input data the rating procedure uses to get the price of the product. The service evaluates this object based on the product rating input mappings to create the input JSON needed by the rating procedure.You format
userInputsdifferently depending on the product definition and the rating configuration. To prevent errors, filter for products that all use the same type ofuserInputsformat. -
Rates each product in the set created in step 2. It calls the product’s associated rating procedure with the input JSON from step 3.
-
Returns an array of product objects with each product's total price and the total insured sum.
Each returned product object also includes the output JSON from the rating procedure as the value of
CalculatedPriceData. The service also setspriceandtotalSumInsuredif the formulas are set on the product.Keep in mind that:
-
If a single attribute is set up with both a Set Value attribute rule and a Set Default Value attribute rule,
getRatedProductsapplies only the Set Default Value attribute rule. -
As a best practice, when you set up attribute rule expressions, don't reference attribute values in lower-level structures.
-
Remote Options
Option |
Description |
|---|---|
|
When For example, a car insurance policy that has multiple drivers insured for multiple cars requires |
|
Set this option to Omit this option for products that don't meet all these criteria. To format |
|
A string of comma-separated input keys to include in the output product object, within the Only input keys used by the calculation procedure have a value in the results. |
|
Use this option for small group rating. |
|
PartOfAProductName If this option is used, the service gets only products with names that contain the value you provided. |
|
productField1, productField2. Sorts the products the service gets in the order you specify. You can use If you don't specify a value for this option, the service sorts products returned by name in ascending alphabetical order. |
Option |
Description |
|---|---|
|
A map of Returns only products that satisfy the attribute values provided in the filter. |
|
Defaults to today's date. Service pulls products with an The service also uses the |
|
Use the API name with a colon followed by either a value or a variable. For example, in an OmniScript, a variable can be a name of an element, such as an input picklist. Separate multiple filter parameters with commas:
Filters can include any field on the |
|
Defaults to In the output JSON, along with the array of products, this adds the Child product attributes aren’t included. |
|
Enter any valid Salesforce SOQL statement as the value for this option. Use this when you need this service to look at multi-picklist fields when searching for products. For example, the statement Important
Remove any reference to the fields in the For example, if you have |
Option |
Description |
|---|---|
|
Defaults to Set this option to If products don't use optional coverages, use the default setting of |
|
Defaults to Includes the entire results of calculation procedure in the |
|
When set to When set to This option is useful when there's no UI consuming the results of the service. For example, if you're running an integration procedure in batch mode that contains this service. |
|
Defaults to Optimizes rating calls by grouping rating procedure calls by products using the same rating procedure. It makes one rating call with an array of input objects. This is useful when pulling a large list of products. Multiple rating calls can hit SQL limits. The rating procedure architecture is optimized to handle an array of input objects and minimize the number of SQL queries needed. |
|
Set this option to true only if you also set |
|
If true, the service returns products without pricing. |
|
“ProductClassName1,ProductClassName2” Comma-separated list of product class names. Limits the list of products to these product classes. |
|
Defaults to This option improves performance by reducing heap sizes. If the rating procedure you're using is defined at the root product level only, you can set this option to |
Option |
Description |
|---|---|
|
|
|
Defaults to When set to Instead, you must provide a list product Id under the key |
|
When set to When set to |
|
Set to |
Option |
Description |
|---|---|
|
Specifies the last product Id that the service pulled into the UI. Use this option with the |
|
Determine how many products the service returns to the UI in one call. |
Input JSON
InsProductService: getRatedProducts looks for a userInputs key in the input JSON. Use the appropriate userInputs format depending on the product definition and the rating configuration. The service accepts only one type of userInputs format at a time.
-
One Rating Procedure per Product for getRatedProducts
Format
userInputsfor products that use a single rating procedure per root product. -
Multiple Rating Procedures per Product or Multiple Specs at Any Level for getRatedProducts
Format
userInputsfor products that use multiple rating procedures in the product hierarchy or multiple child specs in any level of the hierarchy.
Output JSON
The service returns an array of one or more product objects. See the Product JSON Structure Model for more information about this object.
Any
mapped userInputs from the input JSON get added to the product object
as the userValues key of the single instance of the attribute it was
mapped to.
For
each product, the output JSON from the rating procedure calculation gets added to
the product with the CalculatedPriceData key. If the pricing formula is
set on the product, the value of Price will be set to its calculated
value. If the total insured formula is set on the product, the value of
TotalInsured is set to its calculated value.
In
this example, the pricing formula is set on the product, but the total insured
formula isn’t. The CalculatedPriceData is added to the results from the
rating procedure, then the price is calculated based on the formula. The total
insured formula doesn’t appear in the data, nor does
TotalInsured.
{
"totalSize": 2,
"records": [{
"displaySequence": -1,
"CalculatedPriceData": {
"ID": "1",
"basePremium": 719,
"premGenlLiab": "356"
},
"Id": "01t6A000000FshIQAS",
"Name": "Economy Business",
"Family": "Commercial Lines",
"ProductCode": "bop-ECON",
"LineOfBusiness__c": "Property & Casualty",
"Type__c": "BusinessOwners",
"IsRecommended__c": false,
"RecordTypeName__c": "Product",
"IsConfigurable__c": true,
"PricingFormula__c": "basePremium + premGenlLiab",
"Term__c": "Annual",
"productId": "01t6A000000FshIQAS",
"Price": 1075,
"childProducts": {
...
},
"attributeCategories": {
...
}
},
{
...
}
}filterAttrValues Key
The includeFilterAttrValues option puts the product array in a
ratedProducts node and adds a filterAttrValues result
alongside.
{
"result": {
"filterAttrValues": {
"covType": {
"listOfValues": [
"Superior",
"Economy"
],
"valueDataType": "Text",
"attributeName": "Type",
"categoryName": "Policy Terms"
},
"covDeductible": {
"listOfValues": [
"1000",
"250"
],
"valueDataType": "Currency",
"attributeName": "Deductible",
"categoryName": "Policy Terms"
}
},
"ratedProducts": {
"totalSize": 2,
"records": [{
"displaySequence": -1,
"CalculatedPriceData": {
"ID": "1",
"basePremium": 719,
"premGenlLiab": "356"
},
"Id": "01t6A000000FshIQAS",
"Name": "Economy Business",
"Family": "Commercial Lines",
"ProductCode": "bop-ECON",
...,
"Price": 1075,
"childProducts": {
...
},
"attributeCategories": {
...
}
},
{
...
}
}
}
}Each filterable attribute is added to the object with the key set to the attribute code. The value of each filter attribute is an object that contains the following:
Key |
Value |
|---|---|
|
The name of the attribute. |
|
The name of the category. |
|
The list of possible values from the product in the array. |
|
The data type of the attribute, such as Text or Currency. |
Taxes and Fees
If taxes and fees use the service, calculated taxes and fees appear on a JSON record in three distinct ways:
-
If the record has calculated taxes and fees, they’re stored as a list on the
taxesAndFeesfield.{ "taxesAndFees": [{ "Id": 1, "calculatedAmount": 10, "Type__c": "Tax" }, { "Id": 2, "calculatedAmount": 15, "Type__c": "Fee" }] } -
If the record has calculated taxes on itself or its children, the sum of the calculated taxes on itself and its children are stored on the
taxAmountfield.{ "taxAmount”: 25 // 10 from self, 15 from children} -
If the record has calculated fees on itself or its children, the sum of the calculated fees on itself and its children are stored on the
feeAmountfield.{ "feeAmount”: 30 // 15 from self, 15 from children}
A sample JSON output, with taxes and fees on the child records as well as the root, will look something like this:
{
"Id": 1,
"productName": "Product",
"taxesAndFees": [{
"Id": 1,
"calculatedAmount": 10,
"Type__c": "Tax"
}, {
"Id": 2,
"calculatedAmount": 15,
"Type__c": "Fee"
}],
"taxAmount": 25
"feeAmount": 30
"childProducts": {
"records": [{
"Id": 2,
"productName": "Insured Item",
"taxesAndFees": [{
"Id": 3,
"calculatedAmount": 15,
"Type__c": "Tax"
}],
"taxAmount": 15
}, {
"Id": 3,
"productName": "Coverage",
"taxesAndFees": [{
"Id": 4,
"calculatedAmount": 15,
"Type__c": "Fee"
}],
"feeAmount": 15
}]
}
}
Star Rating
You can use the attributeFilters input to filter products based on
ratings, created as attributes by a product modeler.
- One Rating Procedure per Product for getRatedProducts
FormatInsProductService:getRatedProducts userInputsfor products that use a single rating procedure per root product. - Multiple Rating Procedures per Product or Multiple Specs at Any Level for getRatedProducts
FormatInsProductService:getRatedProducts userInputsfor products that use multiple rating procedures in the product hierarchy or multiple child specs in any level of the hierarchy.

