Loading
保险
外部评级和定价

外部评级和定价

对于外部评级和createUpdateQuote,您必须使用简化报价 JSON,该 JSON 已针对与外部策略管理系统的映射进行简化优化。您可以使用InsQuoteService:getQuoteDetail服务生成简化报价 JSON 响应。

例如,当使用立即报价按钮重新定价时,评级集成程序调用InsQuoteService:getQuoteDetail并生成简化的 JSON,通过 HTTP 操作或 Apex 类发送到外部系统。从外部系统返回的响应采用相同的简化 json 格式,评级服务使用该格式来使用返回的信息更新报价记录。

设置产品以使用外部系统:

  1. 设置产品。

    1. External ID 必须具有值。

    2. 设置 Rating Procedure Type = 集成程序。

    3. Set Rating Procedure Name = 集成程序的 Type_Subtype。

  2. 设置集成程序,以调用外部系统进行评级或定价。

    重要
    重要

    将组织设置为允许对外部系统端点的请求。您可以在设置 > 安全性 > 远程站点设置中执行此设置。

    1. 使用选项 isForExternal=true 调用InsQuoteService:getQuoteDetail,并输入action=reprice来准备报价 JSON。

    2. 将报价 JSON 发送到外部系统进行评级。创建向外部系统发送请求的 Apex 类,或在集成程序中使用 HTTP 操作。

    3. 预期外部系统会返回报价 JSON 及价格更新。

    4. ResponseAction的格式:

      {
        "result": {
          "quote": {
            // This is the updated Quote JSON returned in #2
          },
          "errorCode": "INVOKE-200",
          "error": "OK"
        }
      }
      重要
      重要

      在使用 HTTP 操作时,结果会忽略 “error”: “OK”。使用ResponseAction的其他输出选项手动添加此错误。

      错误代码INVOKE-200表示已收到请求。其他消息包括关于服务创建的记录的信息。

      如果服务未生成您预期的输出,请检查调试日志,了解潜在配置问题的相关信息。

为 InsQuoteService 输入 JSON:createUpdateQuoteFromExternal

以下是输入 JSON 的格式:

{
   "quote":{
      "records":[
         {
            "opportunityId":"Opportunity.Id",
            "sourceSystemIdentifier":"Id",
            "sourceSystem":"Name of system quote was created",
            "Name":"Quote Name",
            "type":"Quote.RecordType.DeveloperName",
            "effectiveDate":"Quote.EffectiveDate__c",
            "endDate":"Quote.EndDate__c",
            "price":Quote.StandardPremium__c,
            "term":"Quote.Term__c",
            "status":"Quote.Status",
            "additionalFields":{
               "Quote.fieldAPIName":"value"
            },
            "quoteLines":{
               "records":[
                  {
                     "sourceSystemIdentifier":"Id",
					 "lineRecordType":"Product2",
                     "instanceKey":"name",
                     "productCode":"Product2.ProductCode",
                     "productName":"Product2.Name",
                     "attributeCategories":{
                        "records":[
                           {
                              "productAttributes":{
                                 "records":[
                                    {
                                       "code":"attribute code",
                                       "userValues":"selected value"
                                    }
                                 ]
                              }
                           }
                        ]
                     },
                     "additionalFields":{
                        "QuoteLineItem.fieldAPIName":"value"
                     },
                     "childLines":{
                        "records":[
                           {
                              "sourceSystemIdentifier":"Id",
                              "lineRecordType":"Product2.RecordType.DeveloperName",
                              "productCode":"Product2.ProductCode",
                              "productName":"Product2.Name",
                              "instanceKey":"instance name",
                              "price":QuoteLineItem.UnitPrice,
                              "taxAmount":QuoteLineItem.TaxAmount__c,
                              "feeAmount":QuoteLineItem.FeeAmount__c,
                              "additionalFields":{
                                 "QuoteLineItem.fieldAPIName":"value"
                              },
                              "attributeCategories":{
                                 "records":[
                                    {
                                       "productAttributes":{
                                          "records":[
                                             {
                                                "code":"attribute code",
                                                "userValues":"selected value"
                                             }
                                          ]
                                       }
                                    }
                                 ]
                              },
                              "childLines":{
                                 "records":[
                                    {
                                       "sourceSystemIdentifier":"Id",7e54f959544f",
                                       "lineRecordType":"InsuredPartySpec",
                                       "productCode":"Product2.ProductCode",
                                       "productName":"Product2.Name",
                                       "instanceKey":"instance name",
                                       "price":QuoteLineItem.UnitPrice,
                                       "taxAmount":QuoteLineItem.TaxAmount__c,
                                       "feeAmount":QuoteLineItem.FeeAmount__c,
                                       "isPrimaryChild":true,
                                       "additionalFields":{
                                          "QuoteLineItem.fieldAPIName":"value"
                                       },
                                       "attributeCategories":{
                                          "records":[
                                             {
                                                "productAttributes":{
                                                   "records":[
                                                      {
                                                         "code":"attribute code",
                                                         "userValues":"selected value"
                                                      }
                                                   ]
                                                }
                                             }
                                          ]
                                       }
                                    }
                                 ]
                              }
                           }
                        ]
                     }
                  }
               ]
            }
         }
      ]
   }
}

以下是输入 JSON 的示例:

{
  "quote": {
    "records": [
      {
        "opportunityId": "0065w0000286hhNAAQ",
        "sourceSystemIdentifier": "af3c0072-9018-43df-83d3-3a5f254d5b1e",
        "sourceSystem": "Salesforce",
        "Name": "Auto Root (External)",
        "type": "LargeGroupQuote",
        "effectiveDate": "06/01/2021",
        "endDate": "12/01/2021",
        "price": 10000,
        "term": "Semi-Annual",
        "status": "Submitted",
        "quoteLines": {
          "records": [
            {
              "sourceSystemIdentifier": "49553393-120a-4777-b65a-8167c386a0fb",
              "instanceKey": "Auto Root",
              "productCode": "AUTOROOT",
              "productName": "Auto Root",
              "attributeCategories": {
                "records": [
                  {
                    "productAttributes": {
                      "records": [
                        {
                          "code": "atLimitUM",
                          "userValues": 200
                        }
                      ]
                    }
                  }
                ]
              },
              "additionalFields": {
                "instest12__AdjustmentComments__c": "test comment"
              },
              "childLines": {
                "records": [
                  {
                    "sourceSystemIdentifier": "5a8d1b04-c34c-6a48-42c8-ab08be9868e1",
                    "lineRecordType": "InsuredItemSpec",
                    "Name": "Auto",
                    "productName": "Auto",
                    "productCode": "AUTO",
                    "instanceKey": "2010 Honda Odyssey",
                    "price": 111,
                    "taxAmount": 5,
                    "feeAmount": 21,
                    "additionalFields": {
                      "instest12__AdjustmentComments__c": "test comment"
                    },
                    "attributeCategories": {
                      "records": [
                        {
                          "productAttributes": {
                            "records": [
                              {
                                "code": "autoYear",
                                "userValues": 2010
                              },
                              {
                                "code": "carValue",
                                "userValues": 55000
                              },
                              {
                                "code": "est_annual_mileage",
                                "userValues": 2000
                              },
                              {
                                "code": "autoMake",
                                "userValues": "Honda"
                              },
                              {
                                "code": "autoModel",
                                "userValues": "Odyssey"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "childLines": {
                      "records": [
                        {
                          "sourceSystemIdentifier": "6400140b-3e97-32c4-bdfd-7e54f959544f",
                          "lineRecordType": "InsuredPartySpec",
                          "Name": "Driver",
                          "productName": "Driver",
                          "productCode": "DRIVER",
                          "instanceKey": "Bob Jones",
                          "price": 112,
                          "taxAmount": 6,
                          "feeAmount": 22,
                          "isPrimaryChild": true,
                          "additionalFields": {
                            "instest12__AdjustmentComments__c": "test comment"
                          },
                          "attributeCategories": {
                            "records": [
                              {
                                "productAttributes": {
                                  "records": [
                                    {
                                      "code": "AGE",
                                      "userValues": 24
                                    },
                                    {
                                      "code": "FN",
                                      "userValues": "Bob"
                                    },
                                    {
                                      "code": "LN",
                                      "userValues": "Jones"
                                    },
                                    {
                                      "code": "GENDER",
                                      "userValues": "Male"
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        },
                        {
                          "sourceSystemIdentifier": "38c4fe27-7b85-77ce-c9e2-1f7f22889982",
                          "lineRecordType": "InsuredPartySpec",
                          "Name": "Driver",
                          "productName": "Driver",
                          "productCode": "DRIVER",
                          "instanceKey": "Joan Smith",
                          "price": 113,
                          "taxAmount": 7,
                          "feeAmount": 23,
                          "attributeCategories": {
                            "records": [
                              {
                                "productAttributes": {
                                  "records": [
                                    {
                                      "code": "AGE",
                                      "userValues": 25
                                    },
                                    {
                                      "code": "FN",
                                      "userValues": "Joan"
                                    },
                                    {
                                      "code": "LN",
                                      "userValues": "Smith"
                                    },
                                    {
                                      "code": "GENDER",
                                      "userValues": "Female"
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        },
                        {
                          "sourceSystemIdentifier": "33b74fa2-fba5-44b4-317f-021dae689a9f",
                          "lineRecordType": "CoverageSpec",
                          "Name": "Collision Deductible Waiver",
                          "productName": "Collision Deductible Waiver",
                          "productCode": "COL_WAIVER",
                          "instanceKey": "2010 Honda Odyssey_COL_WAIVER",
                          "price": 114,
                          "taxAmount": 8,
                          "feeAmount": 24
                        },
                        {
                          "sourceSystemIdentifier": "c4d5ac35-99b1-047d-cebe-05b74861463e",
                          "lineRecordType": "CoverageSpec",
                          "Name": "Uninsured/Underinsured Motorist BI",
                          "productName": "Uninsured/Underinsured Motorist BI",
                          "productCode": "UNINSURED_COVERAGE",
                          "instanceKey": "2010 Honda Odyssey_UNINSURED_COVERAGE",
                          "price": 115,
                          "taxAmount": 9,
                          "feeAmount": 25,
                          "attributeCategories": {
                            "records": [
                              {
                                "productAttributes": {
                                  "records": [
                                    {
                                      "code": "AbaThrpyOutptInst_covered_inn",
                                      "userValues": 1.3
                                    },
                                    {
                                      "code": "UNINSURED",
                                      "userValues": "No coverage"
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        }
                      ]
                    }
                  },
                  {
                    "sourceSystemIdentifier": "60699eaf-956a-4381-8ef2-5a704c85517f",
                    "lineRecordType": "InsuredItemSpec",
                    "Name": "Auto",
                    "productName": "Auto",
                    "productCode": "AUTO",
                    "instanceKey": "2011 Toyota Camry",
                    "price": 116,
                    "taxAmount": 10,
                    "feeAmount": 26,
                    "attributeCategories": {
                      "records": [
                        {
                          "productAttributes": {
                            "records": [
                              {
                                "code": "autoYear",
                                "userValues": 2011
                              },
                              {
                                "code": "carValue",
                                "userValues": 55500
                              },
                              {
                                "code": "est_annual_mileage",
                                "userValues": 2200
                              },
                              {
                                "code": "autoMake",
                                "userValues": "Toyota"
                              },
                              {
                                "code": "autoModel",
                                "userValues": "Camry"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "childLines": {
                      "records": [
                        {
                          "sourceSystemIdentifier": "6400140b-3e97-32c4-bdfd-7e54f959544f",
                          "lineRecordType": "InsuredPartySpec",
                          "Name": "Driver",
                          "productName": "Driver",
                          "productCode": "DRIVER",
                          "instanceKey": "Bob Jones",
                          "price": 112,
                          "taxAmount": 6,
                          "feeAmount": 22,
                          "isPrimaryChild": true,
                          "attributeCategories": {
                            "records": [
                              {
                                "productAttributes": {
                                  "records": [
                                    {
                                      "code": "AGE",
                                      "userValues": 24
                                    },
                                    {
                                      "code": "FN",
                                      "userValues": "Bob"
                                    },
                                    {
                                      "code": "LN",
                                      "userValues": "Jones"
                                    },
                                    {
                                      "code": "GENDER",
                                      "userValues": "Male"
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        },
                        {
                          "sourceSystemIdentifier": "8c450354-2053-444c-9c9e-36a66e6f5582",
                          "lineRecordType": "CoverageSpec",
                          "Name": "Collision Deductible Waiver",
                          "productName": "Collision Deductible Waiver",
                          "productCode": "COL_WAIVER",
                          "instanceKey": "2011 Toyota Camry_COL_WAIVER",
                          "price": 117,
                          "taxAmount": 11,
                          "feeAmount": 27
                        },
                        {
                          "sourceSystemIdentifier": "7aaeee37-05ce-4926-accb-dff2ee85587f",
                          "lineRecordType": "CoverageSpec",
                          "Name": "Roadside",
                          "productName": "Roadside",
                          "productCode": "ROADSIDE_COVERAGE",
                          "instanceKey": "2011 Toyota Camry_ROADSIDE_COVERAGE",
                          "price": 118,
                          "taxAmount": 12,
                          "feeAmount": 28,
                          "attributeCategories": {
                            "records": [
                              {
                                "productAttributes": {
                                  "records": [
                                    {
                                      "code": "ROADSIDE",
                                      "userValues": 1
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "instest12__MonthlyPremium__c": 222
        }
      }
    ]
  }
}

适用于 InsQuoteService 的输出 JSON:createUpdateQuoteFromExternal

该服务返回输出 JSON 中已创建或更新报价的Quote.Id和遇到的错误列表。

以下是输出 JSON 的格式:

{
   "errors":[
      "error1",
      "error2",
      "error3"
   ],
   "quoteId":"Quote.Id"
}

以下是输出 JSON 的示例:

{
   "errors":[
      "Failed to create/update QuoteLineItem Honda Odyssey.Required fields are missing: [PricebookEntryId, Product2Id]; ",
      "Failed to create/update QuoteLineItem Toyota Camry.Required fields are missing: [PricebookEntryId, Product2Id]; ",
      "Failed to create/update QuoteLineItem Patty Desc.Required fields are missing: [PricebookEntryId, Product2Id]; "
   ],
   "quoteId":"0Q05w0000027aH5CAI"
}
 
正在加载
Salesforce Help | Article