Loading
保险
AutoSilver 的约束示例

AutoSilver 的约束示例

查看为 AutoSilver 产品模型设计的示例约束,以支持复杂的汽车保险逻辑。

使用这些约束示例来了解如何在车辆特征、覆盖范围选择和跨产品交互之间应用条件逻辑。

如需完整参考,您可以查看完整 Auto Silver CML 文件。

高价值旧车需要医疗保险

如果最贵的车超过 50,000 美元,并且最古老的车在 2020 年之前,则需要有 2000 美元限额的医疗付款保险。

涵盖的内容

  • 多实例约束
  • 需要覆盖范围约束
  • 跨产品约束

CML 示例

type AutoSilver {
    @(closeRelation = true, propagateUp = true, sequence = 1)
    relation auto : Vehicle { 
        maxAutoValue = max(Auto_Value); 
        minAutoYear = min(Year);
    }

    boolean constraint1 = auto.maxAutoValue >= 50000 && auto.minAutoYear < 2020;
    require(constraint1, medicalpayments[MedicalPayments], "Auto add Medical Payments");
    constraint(constraint1 && medicalpayments[MedicalPayments] > 0 -> medicalpayments[MedicalPayments].Limit == 2000, "Medical coverage set to $2000 for older high-value vehicles");
}

type Auto {
    @(configurable = false)
    decimal(2) Auto_Value;

    int Year = [1980..2026];
}

type MedicalPayments {
    @(defaultValue = "1000", domainComputation = false)
    int Limit = [1000, 2000, 5000, 10000, 25000, 50000];
}

新车需要碰撞保险

对于 2023 年之前的车辆,添加碰撞保险,限额为 5000 美元。

什么是封面

  • 需要覆盖范围约束
  • 跨产品约束

CML 示例

type Auto {
    int Year = [1980..2026];
}

type Vehicle : Auto {
    relation collision : Collision[0..1];

    boolean constraint2 = Year > 2023;
    constraint(constraint2 -> collision[Collision], "auto add collision coverage"); 
    constraint(constraint2 && collision[Collision] > 0 -> collision[Collision].Limit == 5000, "set collision limit to 5000");
}

@(split = false)
type Collision {
    @(defaultValue = "1000", domainComputation = false)
    int Limit = [1000, 2000, 5000, 10000, 25000, 50000];
} 

不包括老年车辆的无保险驾驶人保险

防止在车辆超过 2020 年时选择无保险驾驶人保险,并选择 200 美元免赔额的碰撞保险。

涵盖的内容

  • 排除承保范围约束
  • 跨产品约束

CML 示例

type Auto {
    int Year = [1980..2026];
}

type Vehicle : Auto {
    @(sequence = 4)
    relation comprehensive : Comprehensive[0..1];

    @(sequence = 3)
    relation uninsuredMotorist : UninsuredMotorist[0..1];

    boolean constraint3 = collision[Collision] > 0 && collision[Collision].Deductible == 200 && Year < 2020;
    exclude(constraint3, uninsuredMotorist[UninsuredMotorist]);
}

@(split = false)
type Collision {
    @(defaultValue = "1000", domainComputation = false)
    int Limit = [1000, 2000, 5000, 10000, 25000, 50000];

    @(domainComputation = false)
    int Deductible = [0, 50, 100, 200, 500];
}   

@(split = false)
type UninsuredMotorist;

驾驶执照期限验证

确保驾驶员的年龄和首次驾照的年龄都大于 16。

涵盖的内容

  • 基础约束

CML 示例

type Driver {
    @(configurable = false)
    int Age = [0..100];

    int Age_First_Licensed = [0..100];

    message(Age_First_Licensed < 16, "Don’t know who gave you license to driver before 16, legally!", "Warning");
    message(Age < 16, "Error”: Driver is underaged to be added to the quote", "Error");
}

满足特定条件时需要 BIPD

当满足特定车辆、司机和价格条件,并且未选择医疗付款时,此约束需要 BIPD 保险。它还隐藏 BIPD 覆盖范围中的属性和值。

涵盖的内容

  • 多实例约束
  • 需要覆盖范围约束
  • 基数约束
  • 父级基数约束
  • 跨产品约束
  • 孙产品约束
  • 同级产品约束

CML 示例

type AutoSilver {
   @(closeRelation = true, propagateUp = true, sequence = 1)
   relation auto : Vehicle {
       maxDriverAccPoint1 = max(maxDriverAccPoint);
       autoHasAntiTheft = count(Has_Anti_Theft > 0);
   }

   @(sequence = 2)
   relation bodilyinjurypropertydamage : BodilyInjuryPropertyDamage[0..1];
   
   @(sequence = 3)
   relation medicalpayments : MedicalPayments[0..1] {
       medicalLimit = Limit;
       medicalDeductible = Deductible;
  }

  @(tagName = "ItemTotalPrice")
  decimal(2) totalPrice;

   boolean autoCondition = auto[Vehicle] > 0 &&  !auto.autoHasAntiTheft;
   boolean driverCondition = auto.maxDriverAccPoint1 > 5;
   boolean totalPriceCondition = totalPrice > 10;
   boolean constraint5 = autoCondition && driverCondition && totalPriceCondition && medicalpayments[MedicalPayments] == 0;
   @(abort = true)
   require(constraint5, bodilyinjurypropertydamage[BodilyInjuryPropertyDamage], "BIPD is required when Auto IsElectricVehicle and Antitheft is false and Driver accident points > 5 and Collision is selected and MedicalPayments is NOT selected");

}

type Auto {
   boolean Has_Anti_Theft;
}

type Vehicle : Auto {
   int maxDriverAccPoint = driver.maxDriverAccPoint;

   @(closeRelation = true, propagateUp = true, sequence = 1)
   relation driver : AutoDriver[0..5] {
   	maxDriverAccPoint = max(Driver_Accident_Points);
   }

type Driver {
   int Driver_Accident_Points = [0..10];
}

type MedicalPayments {
   @(defaultValue = "1000", domainComputation = false)
   int Limit = [1000, 2000, 5000, 10000, 25000, 50000];

}

@(split = false)
type BodilyInjuryPropertyDamage {
   @(defaultValue = "1000", domainComputation = false)
   int Property_Damage_Per_Accident_Limit = [500, 1000, 1500, 2000];

   @(defaultValue = "1000", domainComputation = false)
   int Bodily_Injury_Per_Accident_Limit = [500, 1000, 1500, 2000];

   boolean rootconstraint5 = parent(constraint5);
   rule(rootconstraint5, "hide", "attribute", "Property_Damage_Per_Accident_Limit");
   rule(rootconstraint5, "hide", "attribute", "Bodily_Injury_Per_Accident_Limit","value", 2000);

}

使用医疗付款的标准用户需要 BIPD

当标准用户选择具有 1000 美元限制和高单价的医疗付款保险时,添加每人 1000 美元身体伤害限制的 BIPD 保险。

涵盖的内容

  • 需要覆盖范围约束
  • 基数约束
  • 跨产品约束
  • 同级产品约束

CML 示例

@(contextPath = "SalesTransaction.UserProfile", attributeSource = "ST")
extern string UserProfile;

type AutoSilver {
   @(sequence = 3)
   relation medicalpayments : MedicalPayments[0..1] {
       medicalLimit = Limit;
       medicalDeductible = Deductible;
       medicalInputUnitPrice = inputUnitPrice;
   }

   @(sequence = 2)
   relation bodilyinjurypropertydamage : BodilyInjuryPropertyDamage[0..1];

   boolean constraint6 = medicalpayments[MedicalPayments] == 1 && medicalpayments.medicalDeductible == 500 && UserProfile == "Standard User" && medicalpayments.medicalInputUnitPrice > 220;
   require(constraint6, bodilyinjurypropertydamage[BodilyInjuryPropertyDamage], "BIPD is required when MedicalPayments is selected at 1k limit");
   constraint(constraint6 && bodilyinjurypropertydamage[BodilyInjuryPropertyDamage] -> bodilyinjurypropertydamage[BodilyInjuryPropertyDamage].Bodily_Injury_Per_Person_Limit == 1000);
}

@(split = false)
type BodilyInjuryPropertyDamage {
   @(defaultValue = "1000", domainComputation = false)
   int Bodily_Injury_Per_Person_Limit = [500, 1000, 1500, 2000];
}

@(split = false)
type MedicalPayments {
   @(defaultValue = "100", domainComputation = false)
   int Deductible = [0, 50, 100, 200, 500];

   @(tagName = "InputUnitPrice")
   decimal(2) inputUnitPrice;
}
 
正在加载
Salesforce Help | Article