You are here:
InsProductService: runRules
Use this service to run rules on a product without repricing that product.
Method: runRules
How It Works
-
The service searches the input JSON for the
selectedProductkey. -
Runs the rules on
selectedProductnode.Which sets of rules get run depends on which remote options are set to true.
-
Returns the JSON with the results of the rules added to the
selectedProductnode.
Remote Options
Option |
Description |
|---|---|
|
Defaults to If true, service runs the attribute set value rules. |
|
Defaults to When this option is set to |
|
When set to true, runs default selected coverage rules for the selected product. |
|
When set to true, runs eligibility rules for the selected product. If the rules evaluate to |
|
When set to true, runs optional coverage required coverage rules. |
|
Defaults to false. When this option is set to The service adds a message node to the affected optional coverage record if the rule evaluates to false. |
Input JSON
This service looks for a product object in the selectedProduct key in its input JSON. This object can be created by other services like getRatedProducts. It includes the root product, child products, and grandchild products.
This example contains only one input node before the service runs the rules.
"Name": "Accidental Death",
"Description": "An accidental death benefit rider also known as a double indemnity clause provides a higher death benefit to the beneficiaries of the policy in case the insured dies because of an accident. The death benefit is generally a multiple of the face value of the base coverage.",
"Family": "Individual Life",
"ProductCode": "ADDCOV",
"LineOfBusiness__c": "Individual Health",
"Type__c": "Coverages",
"IsRecommended__c": false,
"PricingSource__c": "premiumADD",
"RecordTypeName__c": "CoverageSpec",
"IsConfigurable__c": true,
"productId": "01t1U000000OEamQAG",
"pciId": "a2w1U0000001G4YQAU",
"selectValidationCriteria": "[{\"expression\":\"WOP.isSelected == true\",\"code\":\"code_0\"}]",
"selectValidationMessage": "[{\"message\":\"WOP must be true\",\"severity\":\"INFO\",\"code\":\"code_0\"}]",
"isOptional": true,
"isSelected": true,
"parentInstanceKey": "Jack Kirkland",
"Price": 358,
"pathFromRoot": "[0].childProducts.records[2].childProducts.records[2]",
"formattedParentInstanceKey": "jack-kirkland",
"parentProductName": "Jack Kirkland",
"originalIndex": 2,
"numberCategories": 18,
"numberAttributes": 18,
"popoverOpen": false,
"isOriginalOptional": true,
"isAddedOptional": true,
"showTypeHeader": true,
"displaySequence": 1
preTransformBundle Alternative
Alternately, you can define an Omnistudio Data Mapper transform that maps the data that's passed into the input JSON into the form the service needs. This Data Mapper’s output JSON is the selectedProducts node required by runRules. When you add this service to an OmniScript, set preTransformBundle to the name of the Data Mapper to have the service use the Data Mapper.
Output JSON
The service returns the same JSON structure as that in the selectedProduct node with the results of the rules run. See Product JSON Structure Model for details about the contents and structure of this object.
This example contains only one output node after the service runs the rules with the results of the rules run.
"messages": [
{
"code": "code_0",
"severity": "INFO",
"message": "WOP must be true"
}
],
"displaySequence": 1,
"lastNonOptional": true,
"firstOptional": true,
"Id": "01t1U000000OEamQAG",
"Name": "Accidental Death",
"Description": "An accidental death benefit rider also known as a double indemnity clause provides a higher death benefit to the beneficiaries of the policy in case the insured dies because of an accident. The death benefit is generally a multiple of the face value of the base coverage.",
"Family": "Individual Life",
"ProductCode": "ADDCOV",
"LineOfBusiness__c": "Individual Health",
"Type__c": "Coverages",
"IsRecommended__c": false,
"PricingSource__c": "premiumADD",
"RecordTypeName__c": "CoverageSpec",
"IsConfigurable__c": true,
"productId": "01t1U000000OEamQAG",
"pciId": "a2w1U0000001G4YQAU",
"selectValidationCriteria": "[{\"expression\":\"WOP.isSelected == true\",\"code\":\"code_0\"}]",
"selectValidationMessage": "[{\"message\":\"WOP must be true\",\"severity\":\"INFO\",\"code\":\"code_0\"}]",
"isOptional": true,
"isSelected": true,
"parentInstanceKey": "Jack Kirkland",
"Price": 358,
"pathFromRoot": "[0].childProducts.records[2].childProducts.records[2]",
"formattedParentInstanceKey": "jack-kirkland",
"parentProductName": "Jack Kirkland",
"originalIndex": 2,
"numberCategories": 18,
"numberAttributes": 18,
"popoverOpen": false,
"isOriginalOptional": true,
"isAddedOptional": true,
"showTypeHeader": true, 
