Loading
保險
InsQuoteService:createUpdateQuote

InsQuoteService:createUpdateQuote

使用此服務可建立新業務的報價、以新資訊更新現有報價,或建立贊同報價。針對更新,必須在遠端選項中包含要更新的報價quoteId。

備註
備註

在執行此服務之前,系統會執行來賓使用者檢查。

來賓使用者可以使用此服務。執行 OmniScript、整合程序或 UI 工作的來賓使用者將能夠繼續;此服務將會執行。不過,在這些情況下,quoteId 和 opportunityId 會加密,因此來賓使用者看不到這些識別碼。

重要
重要

使用 InsQuoteService:createUpdateQuote 服務來更新報價和報價條列項目,而非使用 Omnistudio 資料對應器。

類別:InsQuoteService

方法:createUpdateQuote

運作方式

  1. 服務會搜尋該 inputKey 的輸入 JSON。inputKey 節點包含服務建立或更新報價所需的資訊。此服務所需的資訊包括:

    • opportunityId

    • endDate (選擇性)

    • effectiveDate

    • productConfigurationDetail 記錄

    • instanceKey

      識別相同規格的多個例項時為必要

    • insuredItems 節點

      在此節點中,服務預期會使用每個規格的 productCode 作為索引鍵,以列出受保項目規格與受保方規格的清單。

    • Term__c

      用於更新「報價」的 Term__c 欄位。

  2. 使用輸入 JSON 中的資訊建立報價。

  3. 傳回輸出 JSON 中的報價識別碼。

  4. 建立包含以下條列項目的報價物件:

    1. 使用在 productConfigurationDetail 中定義的根產品建立或更新根報價條列項目。

    2. 更新現有報價時,系統會新增尚未在報價中的 productConfigurationDetail 記錄,並更新已在報價中的記錄。

    3. 使用受保項目規格、受保方規格和涵蓋範圍規格作為報價條列項目:ParentItemId__c = rootItem.Id.

    4. 主要保險項目的報價條列項目和子系保險對象報價條列具有 many:many 關係。這些關係會儲存在「報價項目關係」物件中。如果保險項目報價條列與多個受保方報價條列有關係,則會使用 PrimaryChildLineitemId__c 欄位來判斷這些關係的哪一個是主要關係。

      例如,Joan Smith 和 John Smith 都是 Lexus 250 的駕駛員;Joan Smith 已設定為主要駕駛員。Lexus 250 報價條列項目具有指向 Joan Smith 報價條列項目的 PrimaryChildLineItemId__c。所有報價條列項目的 ParentItemId2__c 指向 rootItem.Id. 子系涵蓋範圍的 SubParentItemId__c 指向主要受保項目。保險項目報價條列項目和保險對象報價條列項目 ItemName__c 欄位會與此項目的 instanceKey 一起儲存。

    5. 主要投保項目的報價條列項目包含價格。

  5. 針對新報價,如果 createOpportunity 為 true 且未提供 opportunityId,則使用 inputKey 的 OpportunityDetails JSON 節點建立「機會」記錄。

  6. 如果 calculateCommission 為 true,則會呼叫 InsCommissionService.processQuoteCommission,這會為 InsCommissionService.calculate 服務準備輸入。計算服務處理輸入後,會將計算的佣金值儲存在 Quote.CommissionAmount__c 中。

如果欄位集已新增至「報價條列項目」物件,則所有呼叫 InsQuoteService:createUpdateQuote 的使用者必須擁有「報價詳細資料」欄位集中所有欄位的「讀取」權限。

如果未將「報價詳細資料」欄位集新增至「報價條列項目」物件,則所有欄位 (包括自訂欄位) 都可供使用者閱讀。

附加費

以下是此服務使用附加費用的方式 (稅金與費用):

  • 如果在 JSON 記錄上指定 taxesAndFees 欄位,則對應的 QuotePricingAdjustment__c 記錄會保留在 taxesAndFees 清單中的每個項目。

  • 如果在 JSON 記錄上指定 taxAmount 欄位,則 TaxAmount__c 欄位會設定為已建立 QuoteLineItem 上的 taxAmount 欄位值。

  • 如果在 JSON 記錄上指定 feeAmount 欄位,則 FeeAmount__c 欄位會設定為已建立 QuoteLineItem 上的 feeAmount 欄位值。

將其他欄位新增至報價條列項目

如果您需要此服務寫入報價條列項目的其他欄位,您必須先呼叫 InsProductJSONService:trimOffAttributeCategory 服務。

在 OmniScript 或整合程序中執行此作業的流程為:

  1. 產品組態步驟

  2. InsProductJSONService:trimOffAttributeCategory 服務呼叫,其中 selectedValueAsObject 設為 true

  3. DataRaptor 轉換可包含屬性和「報價條列項目」物件中其他欄位之間的對應

  4. InsQuoteService:createUpdateQuote 服務呼叫

遠端選項

選項

描述

createInsuredItemsRelationships

true 或 false

如果此選項設定為 true,您可以指定受保項目之間的 instanceKey > parentInstanceKey 關係清單。

此選項支援父系 > 子系與父系 > 子系 > 孫系保險項目關係。

inputKey

必要。

此服務從中提取必要資訊以建立或更新報價的 JSON 金鑰。

請勿在值的兩邊使用 %。此金鑰代表 JSON 節點,而非變數。

由於此金鑰代表 JSON 節點,而非路徑,因此請勿使用 parent:childnode:childnode 路徑標記法。

若要移至正確的資料路徑,請在將此金鑰/值配對新增至 OmniScript 步驟時,將其輸入至「傳送/回應轉換」區段中的「傳送 JSON 路徑」 欄位。

insertInstance

true 或 false

設定為 true 時,服務會將額外的報價條列項目插入現有報價。不會更新報價標題、根條列項目或任何父系報價條列項目。

使用此選項可透過多個伺服器呼叫建立大型多個例項報價,在此例項的新組報價條列項目會插入至每個呼叫中的現有報價。

quoteId

選擇性。

此服務根據新或更新的資訊更新之現有報價的識別碼。當服務需要更新現有報價時使用。

isMultiRoot

選擇性。

指示報價是否為多根報價的布林值標記。

預設為 false。

minimizeQliQuerySize

true 或 false

設定為 true 時,服務只會查詢受影響的報價條列項目。具體而言,那些在輸入產品 JSON 節點或受保項目 JSON 節點中參照產品的報價條列項目。

populateCalcResults

true 或 false

設定為 false 時,服務不會同時填入 rootItem.CalculatedPriceJSON_c 欄位與 Quote.CalculatedPriceJSON_c 欄位。

pricebook

必要。

與產品規格相關聯的價目手冊名稱。

Salesforce 需要在報價條列項目中使用的產品具有價目手冊項目。

recalculateTaxesAndFees

true 或 false

設定為 true 時,服務會重新計算稅額與費用。

設定為 false 時,服務不會重新計算稅額與費用。

備註
備註

如果您將此選項設定為 false,您也需要將行新增至 ins-coverage-quote-runtime-container UI 範本。

在 ins-coverage-quote-runtime-container.js 中,在 115 行輸入 : optionsMap.recalculateTaxesAndFees = false

createOpportunity

true 或 false

設定為 true 時,如果未提供任何 opportunityId,則服務會使用來自 inputKey 的 OpportunityDetails JSON 節點建立新的「機會」記錄。此節點會對應至機會 sObject 上的欄位。

returnQuote

true 或 false

設定為 true 時,服務的輸出會在 quoteDetail JSON 節點中包含報價詳細資料。

calculateCommission

true 或 false

設定為 true 時,服務會計算根項目的佣金,並將總金額儲存至 Quote.CommissionAmount。

設定為 false (預設值) 時,服務不會計算佣金。

備註
備註

如果您將此選項設定為 true,您也需要輸入至少一個產生者或生產代碼值:primaryProducerId、productionCodeId 或 productionCodeName。

primaryProducerId

選擇性。

處理的產生者識別碼,亦即用於提取 commissionScheduleId 並計算佣金金額的產生者。

productionCodeId

選擇性。

生產代碼識別碼。

productionCodeName

選擇性。

傳遞至 InsCommissionService.calculate 服務的生產代碼名稱。

如果您未輸入 productionCodeId,則服務會使用 productionCodeName 查詢 productionCodeId。如果您輸入兩個值,但這些值不相符,則 productionCodeId 會優先。

runEligibilityRequiredDefaultSelectedRules

選擇性。

預設值為 true。

決定是否執行「資格」與「預設選取」規則。

runRelationshipRules

選擇性。

預設值為 true。

決定是否執行「關係」規則。

runSelectedValivationRules

選擇性。

預設值為 true。

決定是否執行「選取驗證」規則。

輸入 JSON

此服務會尋找 inputKey 的值。前往產品規格上的 API 索引標籤,尋找您需要此服務的輸入 JSON。

針對此範例,inputKey = quotePolicyJSON。

"quotepolicyJson": {
  "productConfigurationDetail": {
    "records": [{
          "rootProductId": "01t1I000002fuBoQAI",
          "rootProductCode": "AUTOROOT",
          "timestamp": 1534288040769,
          "hasInstanceKeys": true,
          "childProductsCount": 4,
          "instanceKeyChildren": 2,
          "pathFromChild": "[0]",
          "pathFromRoot": "[0]",
          "attributeCategories": {
            "records": [{
                "productAttributes": {
                  "records": [{
                      "parentProductId": "01t1I000002fuBoQAI",
                      "parentProductCode": "AUTOROOT",
                      "pathFromChild": "attributeCategories.records[0].productAttributes.records[0]",
                      "pathFromRoot": "attributeCategories.records[0].productAttributes.records[0]",
                      "userValues": "test",
                      "values": [{
                        "disabled": false,
                        "readonly": false
                      }]
                      "totalSize": 1
                    },
                    "id": "a1V1I0000007xJSUAY",
                    "Name": "Alan Health Attributes",
                    "Code__c": "AHA",
                    "displaySequence": 5
                  }
                ],
                "totalSize": 1
              },
              "childProducts": {
                "records": [{
                    "rootProductId": "a2f1I000000BI6JQAW",
                    "rootProductCode": "stolenProperty",
                    "customizeSectionsOpen": null,
                    "numberAttributes": 1,
                    "numberCategories": 1,
                    "originalIndex": 0,
                    "parentProductName": "Auto Root",
                    "pathFromRoot": "[0].childProducts.records[0]",
                    "attributeCategories": {
                      "records": [{
                        "productAttributes": {
                          "records": [{
                            "parentProductId": "a2f1I000000BI6JQAW",
                            "parentProductCode": "stolenProperty",
                            "originalAttributeIndex": 0,
                            "originalCategoryIndex": 0,
                            "originalProductIndex": 0,
                            "pathFromChild": "attributeCategories.records[0].productAttributes.records[0]",
                            "pathFromRoot": "childProducts.records[0].attributeCategories.records[0].productAttributes.records[0]",
                            "userValues": false,
                            "values": [...]
                              ...
                          }]
                          "totalSize": 1
                        },
                        "id": "a1V1I0000007xJSUAY",
                        "Name": "Alan Health Attributes",
                        "Code__c": "AHA",
                        "displaySequence": 5
                      }],
                      "totalSize": 1
                    },
                    "childProducts": {
                      ...
                    }
                    "Price": 80,
                    "productId": "01t1I000002fuBoQAI",
                    "Term__c": "Semi-Annual",
                    "PricingFormula__c": "SUM(AutoPremium__autoPremium + rentalTotal + medicalTotal + roadsideTotal + dedWaiverTotal + uninsuredMotoristPDTotal + uninsuredMotoristBITotal)",
                    "IsConfigurable__c": true,
                    "RecordTypeName__c": "Product",
                    "IsRecommended__c": false,
                    "ProductCode": "AUTOROOT",
                    "Name": "Auto Root",
                    "Id": "01t1I000002fuBoQAI",
                    "RawPriceData": [{
                        "aggregationResults": {},
                        "calculationResults": [{
                            "ID": "0",
                            "comprehensiveTotal": 500,
                            "rentalTotal": 40,
                            "medicalTotal": 10,
                            "roadsideTotal": 10,
                            "dedWaiverTotal": 10,
                            "uninsuredMotoristPDTotal": 0,
                            "uninsuredMotoristBITotal": 100,
                            "AUTO.instanceKey": "2015 Lexus LX250",
                            "DRIVER.FN": "Joan",
                            "DRIVER.LN": "Smith"
                          },
                          "ID": "1",
                          "comprehensiveTotal": 500,
                          "rentalTotal": 40,
                          "medicalTotal": 10,
                          "roadsideTotal": 10,
                          "dedWaiverTotal": 10,
                          "uninsuredMotoristPDTotal": 0,
                          "uninsuredMotoristBITotal": 100,
                          "AUTO.instanceKey": "2015 Lexus LX250",
                          "DRIVER.FN": "John",
                          "DRIVER.LN": "Smith"
                        },
                        ...
                      ]
                    },
                    {
                      "aggregationResults": {},
                      "calculationResults": [{
                          "ID": "4",
                          "comprehensiveTotal": 500,
                          "rentalTotal": 40,
                          "medicalTotal": 10,
                          "roadsideTotal": 10,
                          "dedWaiverTotal": 10,
                          "uninsuredMotoristPDTotal": 0,
                          "uninsuredMotoristBITotal": 100,
                          "AUTO.instanceKey": "2006 Honda Odyssey",
                          "DRIVER.FN": "Joan",
                          "DRIVER.LN": "Smith"
                        },
                        {
                          "ID": "5",
                          "comprehensiveTotal": 500,
                          "rentalTotal": 40,
                          "medicalTotal": 10,
                          "roadsideTotal": 10,
                          "dedWaiverTotal": 10,
                          "uninsuredMotoristPDTotal": 0,
                          "uninsuredMotoristBITotal": 100,
                          "AUTO.instanceKey": "2006 Honda Odyssey",
                          "DRIVER.FN": "John",
                          "DRIVER.LN": "Smith"
                        },
                        ...
                      ]
                    }
                  ],
                  "CalculatedPriceData": {
                    "2006 Honda Odyssey": {
                      "ID": "4",
                      "comprehensiveTotal": 500,
                      "rentalTotal": 40,
                      "medicalTotal": 10,
                      "roadsideTotal": 10,
                      "dedWaiverTotal": 10,
                      "uninsuredMotoristPDTotal": 0,
                      "uninsuredMotoristBITotal": 100,
                      "AUTO.instanceKey": "2006 Honda Odyssey",
                      "DRIVER.FN": "Joan",
                      "DRIVER.LN": "Smith"
                    },
                    "2015 Lexus LX250": {
                      "ID": "0",
                      "comprehensiveTotal": 500,
                      "rentalTotal": 40,
                      "medicalTotal": 10,
                      "roadsideTotal": 10,
                      "dedWaiverTotal": 10,
                      "uninsuredMotoristPDTotal": 0,
                      "uninsuredMotoristBITotal": 100,
                      "AUTO.instanceKey": "2015 Lexus LX250",
                      "DRIVER.FN": "Joan",
                      "DRIVER.LN": "Smith"
                    }
                  },
                  "displaySequence": -1
                }
              ]
            },
            "insuredItems": {
              "DRIVER": [{
                  "isPrimary": false,
                  "instanceKey": "Joan Smith",
                  "LN": "Smith",
                  "AGE": 20,
                  "FN": "Joan",
                  "GENDER": "Female",
                  "FirstName": "Joan",
                  "LastName": "Smith",
                  "partyId": "a0q1I000001emNeQAI"
                },
                {
                  "isPrimary": false,
                  "instanceKey": "John Smith",
                  "LN": "Smith",
                  "AGE": 30,
                  "FN": "John",
                  "GENDER": "Male",
                  "FirstName": "John",
                  "LastName": "Smith",
                  "partyId": "a0q1I000001emNfQAI"
                },
              ],
              "AUTO": [{
                  "autoLicNum": "Lexus",
                  "autoModel": "LX250",
                  "autoYear": 2015,
                  "instanceKey": "2015 Lexus LX250",
                  "BodyClass": "Sedan/Saloon",
                  "VehicleType": "PASSENGER CAR",
                  "isPrimary": true
                },
                {
                  "autoLicNum": "Honda",
                  "autoModel": "Odyssey",
                  "autoYear": 2006,
                  "instanceKey": "2006 Honda Odyssey",
                  "BodyClass": "Minivan",
                  "VehicleType": "MULTIPURPOSE PASSENGER VEHICLE (MPV)",
                  "isPrimary": true
                }
              ]
            },
            "accountId": "0011I00000QknfjQAB",
            "opportunityId": "0061I00000AV8gBQAT"
          }

inputKey 內部的 JSON 包含服務建立或更新報價所需的數個金鑰/值配對。

關鍵字

值

opportunityId

產生的機會識別碼。

accountId

產生的帳戶識別碼。

endDate

選擇性。

保單到期的日期。

effectiveDate

原則生效的日期。

productConfigurationDetail

跟隨產品 JSON 結構模型的記錄陣列。

系統會為陣列中的每個產品記錄建立或修改根報價條列項目。

若要瞭解產品的結構和內容,請參閱產品 JSON 結構模型。

additionalFields

選擇性。

additionalFields 金鑰僅適用於根引號的金鑰/值配對,不適用於引號條列項目。針對報價條列項目,使用 productConfigurationDetail JSON 新增 additionalFields。

insuredItems

服務用來建立保險項目的報價條列項目之保險項目的金鑰/值配對。

無論您的報價包含受保項目的單一例項或多個受保項目,請使用記錄陣列格式化 insuredItems 節點。

"insuredItems": {
  "DRIVER": [{
    "isPrimary": false,
    "instanceKey": null,
    "additionalFields": {},
    "productCode": "DRIVER",
    "productId": "01t1I000002fuByQAI",
    "FN": null,
    "GENDER": null,
    "LN": null,
    "partyId": null
  }],
  "AUTO": [{
    "isPrimary": true,
    "instanceKey": null,
    "additionalFields": {},
    "productCode": "AUTO",
    "productId": "01t1I000002fuBtQAI",
    "autoBrakes": false,
    "est_annual_mileage": "10001-20000",
    "autoLicNum": null,
    "autoModel": null,
    "autoStyle": null,
    "autoVIN": null,
    "autoYear": ""
  }]
}

針對直接位於產品階層中根產品下的受保項目單一例項,您可以使用此範例中的格式。此處的 insuredItems 記錄包含投保項目,以及使用者為每個項目選取的值。我們支援此輸入 JSON,但來自較早版本且不建議使用。

"insuredItems": {
  "smallBusiness": {
    "protectionClass": 3,
    "yearBuilding": 2000,
    "yearWiring": 2000,
    "yearRoof": 2003,
    "yearPlumbing": 2000,
    "yearBusiness": 2002,
    "businessParkingLot": "no",
    "legalForm": "sole",
    "busLocation": "standalone",
    "busHours": 8,
    "busEmployees": 24,
    "bldgSprinker": "Y",
    "bldgFrame": "frame",
    "bldgAlarm": "none",
    "ageWiring": 18,
    "ageRoof": 15,
    "agePlumbing": 18,
    "ageBusiness": 16,
    "ageBuilding": 18,
    "SIC": "5451",
    "SICCategory": "Food Stores"

針對新報價,如果 createOpportunity 為 true 且未提供 opportunityId,則服務會使用來自 inputKey 的 OpportunityDetails JSON 節點建立新的「機會」記錄。使用輸入格式 OpportunityDetails:FieldName。以下是 OpportunityDetails 節點的範例。

"OpportunityDetails": {
      "AccountId": "0015f00000DSFgqAAH",
      "Name": "Auto Quote: Rachel Adams (2022-01-03)",
      "StageName": "Qualification",
      "CloseDate": "2022-01-03"
    },
備註
備註

preTransformBundle Alternative

或者,您也可以定義 DataRaptor 轉換,將傳入輸入 JSON 的資料對應至服務需要的形式。此 DataRaptor 的輸出 JSON 是產品檢視其 API 索引標籤中定義的 userInputs JSON。將 preTransformBundle 選項設定為 DataRaptor 的名稱,讓服務使用 DataRaptor。

輸出 JSON

服務會傳回新建立的報價的報價識別碼。如果 returnQuote 輸入為 true,則也會傳回報價詳細資料,如果 createOpportunity 為 true 且未提供 opportunityId,則也會傳回機會識別碼。

{
  "quoteDetail": {
    "stmpbhins04__PrimaryRootItemId__c": "0QLR00000000e3NOAQ",
    "stmpbhins04__TotalPremiumforTerm__c": 2000,
    "stmpbhins04__MonthlyPremium__c": 166.66666666666666,
    "stmpbhins04__StandardPremium__c": 2000,
    "Id": "0Q0R00000000WplKAE",
    "stmpbhins04__EndDate__c": "2022-05-04",
    "stmpbhins04__EffectiveDate__c": "2021-05-05",
    "stmpbhins04__Term__c": "Annual",
    "Name": "Auto Root",
    "OpportunityId": "006R0000002xk8QIAQ",
    "Pricebook2Id": "01sR0000001GULqIAO"
  },
  "quoteId": "0Q0R00000000WplKAE",
  "opportunityId": "006R0000002xk8QIAQ",
  "error": "OK"
}
 
正在載入
Salesforce Help | Article