您位於此處:
InsQuoteService:createUpdateQuote
使用此服務可建立新業務的報價、以新資訊更新現有報價,或建立贊同報價。針對更新,必須在遠端選項中包含要更新的報價quoteId。
運作方式
-
服務會搜尋該
inputKey的輸入 JSON。inputKey節點包含服務建立或更新報價所需的資訊。此服務所需的資訊包括:-
opportunityId -
endDate(選擇性) -
effectiveDate -
productConfigurationDetail記錄 -
instanceKey識別相同規格的多個例項時為必要
-
insuredItems節點在此節點中,服務預期會使用每個規格的
productCode作為索引鍵,以列出受保項目規格與受保方規格的清單。 Term__c用於更新「報價」的 Term__c 欄位。
-
-
使用輸入 JSON 中的資訊建立報價。
-
傳回輸出 JSON 中的報價識別碼。
-
建立包含以下條列項目的報價物件:
-
使用在
productConfigurationDetail中定義的根產品建立或更新根報價條列項目。 -
更新現有報價時,系統會新增尚未在報價中的
productConfigurationDetail記錄,並更新已在報價中的記錄。 -
使用受保項目規格、受保方規格和涵蓋範圍規格作為報價條列項目:
ParentItemId__c = rootItem.Id. -
主要保險項目的報價條列項目和子系保險對象報價條列具有 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一起儲存。 -
主要投保項目的報價條列項目包含價格。
-
-
針對新報價,如果
createOpportunity為true且未提供opportunityId,則使用inputKey的OpportunityDetailsJSON 節點建立「機會」記錄。 -
如果
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 服務。
-
產品組態步驟
-
InsProductJSONService:trimOffAttributeCategory 服務呼叫,其中 selectedValueAsObject 設為 true
-
DataRaptor 轉換可包含屬性和「報價條列項目」物件中其他欄位之間的對應
-
InsQuoteService:createUpdateQuote 服務呼叫
遠端選項
選項 |
描述 |
|---|---|
|
如果此選項設定為 此選項支援父系 > 子系與父系 > 子系 > 孫系保險項目關係。 |
|
必要。 此服務從中提取必要資訊以建立或更新報價的 JSON 金鑰。 請勿在值的兩邊使用 %。此金鑰代表 JSON 節點,而非變數。 由於此金鑰代表 JSON 節點,而非路徑,因此請勿使用 parent:childnode:childnode 路徑標記法。 若要移至正確的資料路徑,請在將此金鑰/值配對新增至 OmniScript 步驟時,將其輸入至「傳送/回應轉換」區段中的「傳送 JSON 路徑」 欄位。 |
|
設定為 使用此選項可透過多個伺服器呼叫建立大型多個例項報價,在此例項的新組報價條列項目會插入至每個呼叫中的現有報價。 |
|
選擇性。 此服務根據新或更新的資訊更新之現有報價的識別碼。當服務需要更新現有報價時使用。 |
|
選擇性。 指示報價是否為多根報價的布林值標記。 預設為 |
|
設定為 |
|
設定為 |
|
必要。 與產品規格相關聯的價目手冊名稱。 Salesforce 需要在報價條列項目中使用的產品具有價目手冊項目。 |
|
設定為 設定為 備註
如果您將此選項設定為 false,您也需要將行新增至 在 |
|
設定為 |
|
設定為 |
|
設定為 設定為 備註
如果您將此選項設定為 true,您也需要輸入至少一個產生者或生產代碼值: |
|
選擇性。 處理的產生者識別碼,亦即用於提取 |
|
選擇性。 生產代碼識別碼。 |
|
選擇性。 傳遞至 InsCommissionService.calculate 服務的生產代碼名稱。 如果您未輸入 |
runEligibilityRequiredDefaultSelectedRules
|
選擇性。 預設值為 決定是否執行「資格」與「預設選取」規則。 |
runRelationshipRules
|
選擇性。 預設值為 決定是否執行「關係」規則。 |
runSelectedValivationRules
|
選擇性。 預設值為 決定是否執行「選取驗證」規則。 |
輸入 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 包含服務建立或更新報價所需的數個金鑰/值配對。
關鍵字 |
值 |
|---|---|
|
產生的機會識別碼。 |
|
產生的帳戶識別碼。 |
|
選擇性。 保單到期的日期。 |
|
原則生效的日期。 |
|
跟隨產品 JSON 結構模型的記錄陣列。 系統會為陣列中的每個產品記錄建立或修改根報價條列項目。 若要瞭解產品的結構和內容,請參閱產品 JSON 結構模型。 |
|
選擇性。
|
|
服務用來建立保險項目的報價條列項目之保險項目的金鑰/值配對。 |
無論您的報價包含受保項目的單一例項或多個受保項目,請使用記錄陣列格式化 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"
}