You are here:
InsPolicyService:invokeProductRules
Use this service with a policy to invoke underwriting rules you've added to a product.
For example, if you'd added rules that send certain policies to an underwriter for approval, this service invokes those rules.
How It Works
-
Finds the policy (asset) based on the
objectIDand extracts the products for that object based on thatobjectID. -
Looks for the specified
transitionName. -
Runs the rules associated with the product and applicable to the
transitionName -
If any of the rules evaluate to true, the service executes the Vlocity action specified in those rules.
For example, if the action specifies that a task is created, the service creates a task.
-
Looks for the value of the
includeStateTransitionoption. If the value = true, the service looks for the state model for this object, finds thefieldAPINamevalue, and changes that value based on the transition.
Remote Options
Option |
Description |
|---|---|
|
If true, the service changes the state field specified in the state model's If false, the service does not do any state transition. |
|
The policy (asset) Id queried. |
|
The state transition name associated with the rules you want to run. The service will run only rules associated with the To find a Transition Name, go to the state model for this object. |
|
Optional. The state the service transitions the object to when all rules run by the service evaluate to false. The service transitions the object to this state only if |
Output JSON
The service returns several key/value pairs, an array of rules evaluated to false, and an array of rules evaluated to true.
{
"stateTransit": " updated Status from Submit to Underwriting",
"canTransitState": true,
"allFalse": false,
"falseRules": [...]
"trueRules": [...]
"error": "OK"
}This JSON includes the following key/value pairs:
Key |
Value |
|---|---|
|
Describes what the service changed in the Status field on the policy (asset) object. |
|
Tells whether or not the service transitions the object to a new state. |
|
If all of the rules run by the service evaluate to false, If any of the rules run by the service evaluates to true, |
|
An array of one or more Includes all rules run by the service that evaluate to false. |
|
An array of one or more Includes all rules run by the service that evaluate to true. Appears only if |
|
Any errors encountered by the service. If the value is ok, no error messages appear on the UI. |
The falseRules and trueRules arrays both include ruleDetails key/value pairs.
"ruleDetails": {
"requirement name": "Operator Points >4",
"conditions": "wcOperator.opPoints > 4",
"message": "The applicant's prior citations require underwriting review prior to issuance.",
"action method": "ReferToUnderwriting",
"action class": "DROpenImplementationClass",
"productId": "01tf4000001lKNQAA2",
"transitionName": "Submit>Underwrite",
"objectId": "0Q0f4000000ADatCAG"
}The trueRules array includes one or more actionResults, additional key/value pairs, and rulesDetails.
The actionResults are the output of the Vlocity action class and action method invoked by the service.
"trueRules": [
{
"actionResults": {
"Task_1": [
{
"UpsertSuccess": true,
"Id": "00Tf400000LNkx9EAD",
"ActivityDate": "2018-05-21",
"WhatId": "0Q0f4000000ADatCAG",
"Description": "The value of this vessel requires underwriting review.",
"Subject": "Total Value"
}
],
"error": "OK",
"responseType": "SObject"
},
"ruleDetails": {
"requirement name": "Total Value",
"conditions": "WC.wcValue > 250000",
"message": "The value of this vessel requires underwriting review.",
"action method": "ReferToUnderwriting",
"action class": "DROpenImplementationClass",
"productId": "01tf4000001lKNQAA2",
"transitionName": "Submit>Underwrite",
"objectId": "0Q0f4000000ADatCAG"
}
},
}
],
