You are here:
InsPolicyService:createUpdatePolicy
Use this service to create a new insurance policy or to update an existing policy with new information.
This service can be used with Salesforce Financial Services Cloud for optional Payment Schedule creation support.
How it works
-
The service searches the input JSON for the
inputKey. TheinputKeynode contains the information the service needs to create or update a policy. The information this service requires includes:-
accountId -
term -
productConfigurationDetailrecords -
insuredItemsrecords (optional) -
endDate -
effectiveDate
-
-
Creates a Policy (asset) object.
-
If there's an existing payment schedule for the policy, the service returns an error message.
-
If there's an initial payment, an InsurancePolicyTransaction will be created. In addition to the creation of the transaction, transaction breakdown data populates into the transaction detail object. This object stores data about how much each asset, participant, or coverage contributes to total transaction amounts in terms of premium, tax, and fees. Only assets, participants, and coverages with at least one value greater than zero for premium, tax, or fees are displayed. You must add the transaction detail object to the Related List for Transaction.
-
If saving the payment schedule, the records will be linked to the Policy's Original Policy Id.
-
If
taxesAndfees,taxAmount, and/orfeeAmountnodes are present in the input JSON, the tax and/or fee records are created. -
Returns a policy ID in the output JSON if the service is not passed an
assetId.If the service is passed an
assetIdin the input JSON, it updates the asset specified by theassetId. -
If
calculateCommission=true: the service callsInsurancePolicyService.calculateAndSaveCommission, which prepares the input for theInsCommissionService.calculateandInsCommissionService.saveCommissionsservices. After the calculate service processes the input, the save service stores the calculated value inTotalCommissionAmount.-
The service calls
InsurancePolicyService.calculateAndSaveCommission, which prepares the input for theInsCommissionService.calculateandInsCommissionService.saveCommissionsservices. -
The commission type (for example, Commission or Bonus) is passed to the
InsCommissionService.saveCommissionsservice ascommissionType. -
The commission status (for example, Waived or Paid) is passed to the
InsCommissionService.saveCommissionsservice ascommissionStatus.
After the calculate service processes the input, the save service stores the calculated value in
TotalCommissionAmount. -
endDate and effectiveDate determine the policy duration. The duration of the first policy version can be less than 365 days, or less than 366 days in a leap year. See Considerations and Limitations for Insurance Policies.Taxes and Fees
Here's how this service works if taxes and fees are used:
If the
taxesAndFeesfield is specified on a JSON record, a correspondingAssetPricingAdjustment__crecord persists for each item in thetaxesAndFeeslist.If the
taxAmountfield is specified on a JSON record, theTaxAmount__cfield is set to the value of the taxAmount field on the createdAssetItem.If the
feeAmountfield is specified on a JSON record, theFeeAmount__cfield is set to the value of thefeeAmountfield on theAssetItem.
Remote Options
Input JSON
This service looks for the value of the inputKey.
For this example, inputKey = newPolicyJSON.
"newPolicyJSON": {
"accountId": "001f400000OSHq2AAH",
"term": "Annual",
"endDate": "2019-05-14T07:00:00.000Z",
"effectiveDate": "2018-05-15T07:00:00.000Z",
"productConfigurationDetail": {
...
},
"insuredItems": {
...
},
"additionalFields": {
"SerialNumber": "AUTO-123",
"Status": "InForce",
"vlocityins2__Type__c": "AUTO",
"vlocityins2__PaymentMethodId__c": "a2Rf40000002NrgEAE"
},
}The JSON inside the inputKey includes several key/value pairs the service needs to create or update a policy. It also includes the product JSON, with pricing for the insured items and the total policy.
Key |
Value |
|---|---|
|
The generated account Id for the asset. |
|
Optional. Key/value pairs including any policy (asset) fields that are not part of the service. |
|
Optional. The date that the policy expires. |
|
The date that the policy goes into effect. If there's no |
|
The key/value pairs of the insured items the service uses to create the policy. |
|
The date the policy was modified |
|
An array of records that follow the product JSON structure model. |
|
The term of the policy the service will create. |
The insuredItems records for this example includes the insured items and the values the user selected for each one.
For this example, inputKey = quotepolicyJSON.
"quotepolicyJson": {
"productConfigurationDetail": {
...
}
"insuredItems": {
"DRIVER": [{
"GENDER": "Female",
"FN": "Joan",
"AGE": 20,
"LN": "Smith",
"instanceKey": "Joan Smith",
"isPrimary": false
"isParent": false
},
{
"GENDER": "Male",
"FN": "John",
"AGE": 30,
"LN": "Smith",
"instanceKey": "John Smith",
"isPrimary": false
"isParent": false
},
{
"GENDER": "Male",
"FN": "Robert",
"AGE": 30,
"LN": "Henderson",
"instanceKey": "Robert Henderson",
"isPrimary": false
"isParent": false
},
{
"GENDER": "Female",
"FN": "Kinsey",
"AGE": 20,
"LN": "Schell",
"instanceKey": "Kinsey Schell",
"isPrimary": false
"isParent": false
}
],
"AUTO": [{
"autoLicNum": "Lexus",
"autoModel": "LX250",
"autoYear": 2015,
"instanceKey": "2015 Lexus LX250",
"BodyClass": "Sedan/Saloon",
"VehicleType": "PASSENGER CAR",
"isPrimary": true
"isParent": true
},
{
"autoLicNum": "Honda",
"autoModel": "Odyssey",
"autoYear": 2006,
"instanceKey": "2006 Honda Odyssey",
"BodyClass": "Minivan",
"VehicleType": "MULTIPURPOSE PASSENGER VEHICLE (MPV)",
"isPrimary": true
"isParent": true
}
]
},
"accountId": "0011I00000QknfjQAB",
"opportunityId": "0061I00000AV8gBQAT"
},
"quoteId": "0Q01I000000206USAQ",
"error": "OK"Output JSON
The service returns the policy ID of the newly created policy.
{
"policyId": "02if4000001uCZXAA2",
"error": "OK"
}If the isCreatingPolicyTerms remote option is set to true, a policyTermIds node is included. Here's an example of a policyTermIds node:
{
"policyId": "02i6g000000h110AAA",
"policyTermIds": [
"a5X6g000001LeUUEA0",
"a5X6g000001LeUVEA0",
"a5X6g000001LeUWEA0",
"a5X6g000001LeUXEA0",
"a5X6g000001LeUYEA0",
"a5X6g000001LeUZEA0",
"a5X6g000001LeUaEAK",
"a5X6g000001LeUbEAK",
"a5X6g000001LeUcEAK",
"a5X6g000001LeUdEAK",
"a5X6g000001LeUeEAK",
"a5X6g000001LeUfEAK"
]
}
