您位於此處:
InsProductService:runRules
使用此服務可對產品執行規則,而無須重新定價該產品。
方法:runRules
運作方式
-
服務會搜尋輸入 JSON 以取得
selectedProduct金鑰。 -
在
selectedProduct節點上執行規則。執行的規則集取決於設定為 true 的遠端選項。
-
傳回具有新增至
selectedProduct節點之規則結果的 JSON。
遠端選項
選項 |
描述 |
|---|---|
|
預設為 如果為 true,則服務會執行屬性集值規則。 |
|
預設為 將此選項設定為 |
|
設定為 true 時,會針對所選產品執行預設選取的涵蓋範圍規則。 |
|
設定為 true 時,執行所選產品的資格規則。 如果規則評估為 |
|
設定為 true 時,執行選用涵蓋範圍必要涵蓋規則。 |
|
預設為 False。 將此選項設定為 如果規則評估為 false,則服務會將訊息節點新增至受影響的選用涵蓋範圍記錄。 |
輸入 JSON
此服務會在其輸入 JSON 的 selectedProduct 金鑰中尋找產品物件。其他服務 (例如 getRatedProducts) 可以建立此物件。其中包含根產品、子系產品和孫系產品。
此範例僅包含服務執行規則之前的一個輸入節點。
"Name": "Accidental Death",
"Description": "An accidental death benefit rider also known as a double indemnity clause provides a higher death benefit to the beneficiaries of the policy in case the insured dies because of an accident. The death benefit is generally a multiple of the face value of the base coverage.",
"Family": "Individual Life",
"ProductCode": "ADDCOV",
"LineOfBusiness__c": "Individual Health",
"Type__c": "Coverages",
"IsRecommended__c": false,
"PricingSource__c": "premiumADD",
"RecordTypeName__c": "CoverageSpec",
"IsConfigurable__c": true,
"productId": "01t1U000000OEamQAG",
"pciId": "a2w1U0000001G4YQAU",
"selectValidationCriteria": "[{\"expression\":\"WOP.isSelected == true\",\"code\":\"code_0\"}]",
"selectValidationMessage": "[{\"message\":\"WOP must be true\",\"severity\":\"INFO\",\"code\":\"code_0\"}]",
"isOptional": true,
"isSelected": true,
"parentInstanceKey": "Jack Kirkland",
"Price": 358,
"pathFromRoot": "[0].childProducts.records[2].childProducts.records[2]",
"formattedParentInstanceKey": "jack-kirkland",
"parentProductName": "Jack Kirkland",
"originalIndex": 2,
"numberCategories": 18,
"numberAttributes": 18,
"popoverOpen": false,
"isOriginalOptional": true,
"isAddedOptional": true,
"showTypeHeader": true,
"displaySequence": 1
preTransformBundle Alternative
或者,您也可以定義 Omnistudio 資料對應器轉換,將傳入輸入 JSON 的資料對應至服務所需的表單。此「資料對應器」的輸出 JSON 是 runRules 所需的 selectedProducts 節點。將此服務新增至 OmniScript 時,請將 preTransformBundle 設為「資料對應器」名稱,讓服務使用「資料對應器」。
輸出 JSON
服務會傳回與 selectedProduct 節點中的相同 JSON 結構,並執行規則的結果。如需此物件內容與結構的詳細資料,請參閱「產品 JSON 結構模型」。
此範例僅包含服務執行規則並執行規則的結果後的一個輸出節點。
"messages": [
{
"code": "code_0",
"severity": "INFO",
"message": "WOP must be true"
}
],
"displaySequence": 1,
"lastNonOptional": true,
"firstOptional": true,
"Id": "01t1U000000OEamQAG",
"Name": "Accidental Death",
"Description": "An accidental death benefit rider also known as a double indemnity clause provides a higher death benefit to the beneficiaries of the policy in case the insured dies because of an accident. The death benefit is generally a multiple of the face value of the base coverage.",
"Family": "Individual Life",
"ProductCode": "ADDCOV",
"LineOfBusiness__c": "Individual Health",
"Type__c": "Coverages",
"IsRecommended__c": false,
"PricingSource__c": "premiumADD",
"RecordTypeName__c": "CoverageSpec",
"IsConfigurable__c": true,
"productId": "01t1U000000OEamQAG",
"pciId": "a2w1U0000001G4YQAU",
"selectValidationCriteria": "[{\"expression\":\"WOP.isSelected == true\",\"code\":\"code_0\"}]",
"selectValidationMessage": "[{\"message\":\"WOP must be true\",\"severity\":\"INFO\",\"code\":\"code_0\"}]",
"isOptional": true,
"isSelected": true,
"parentInstanceKey": "Jack Kirkland",
"Price": 358,
"pathFromRoot": "[0].childProducts.records[2].childProducts.records[2]",
"formattedParentInstanceKey": "jack-kirkland",
"parentProductName": "Jack Kirkland",
"originalIndex": 2,
"numberCategories": 18,
"numberAttributes": 18,
"popoverOpen": false,
"isOriginalOptional": true,
"isAddedOptional": true,
"showTypeHeader": true, 