API Version
68.0
Requires Chatter
No
Signature
public static ConnectApi.InsCMLModelValidationRepresentation validateCMLModel(ConnectApi.InsCMLModelValidationInputRepresentation insCMLModelValidationInputRepresentation)
Parameters
- insCMLModelValidationInputRepresentation
- Type: ConnectApi.InsCMLModelValidationInputRepresentation
- Required. Input that identifies the root products to validate and optional related surcharge, clause, and underwriting rule records to check against the active CML model.
Return Value
Usage
Use this method at design time to verify CML model integrity for Digital Insurance products. Provide a required list of product IDs and optional lists of product surcharge, insurance product clause, and underwriting rule IDs. The method checks that an active CML model exists for each product and that each related record’s product path or rule key is correctly declared in the active CML.
Validations include confirming that an active constraint expression set is associated with each root product; that surcharge and clause product paths are present in the CML association when no rule key is set; that rule keys for surcharges, clauses, and underwriting rules are declared in an active CML body; and that each referenced surcharge, clause, and underwriting rule record exists. An underwriting rule with a blank rule key is treated as a BRE-based rule and marked valid with an informational instruction.
When every record passes validation, isValid is true. When one or more records fail, isValid is false and results lists each record with its outcome. Per-record failures appear in results, not in errors. Examples include:
- SF-INS-DSAV-00034 — no active CML model is associated with the product.
- SF-INS-DSAV-00035 — the record’s product path is empty.
- SF-INS-DSAV-00036 — one or more products in the product path aren’t referenced by the active CML model.
- SF-INS-DSAV-00037 — the specified record wasn’t found.
- SF-INS-DSAV-00039 — the record’s rule key isn’t declared in any active CML model.
Top-level errors are returned in errors when the request can’t be validated per record. A missing or empty productIds list returns SF-INS-DSAV-00033.
Example
This sample validates a CML model from Apex.
ConnectApi.InsCMLModelValidationInputRepresentation input =
new ConnectApi.InsCMLModelValidationInputRepresentation();
input.productIds = new List<String>{ '01txx0000006i3DAAQ' };
input.productSurchargeIds = new List<String>{ '1Xrxx0000000001CAA' };
ConnectApi.InsCMLModelValidationRepresentation result =
ConnectApi.InsuranceDesignAdvisorFamily.validateCMLModel(input);
System.debug('isValid=' + result.isValid);
System.debug('results=' + result.results);
System.debug('errors=' + result.errors);