---
schema_version: "1"
id: ce786eaa96fce4d6b448fdb0518cfe2579ccb44d0320681d207d53db5e0086d1
title: validateCMLModel(insCMLModelValidationInputRepresentation)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_validateCMLModel_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_validateCMLModel_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1d0a6ae427c2e6b7c3ea35efa26a4bdb788f75a41172634bc4cac468a3b0b73a
description: Validate the active CML (Constraint Markup Language) model for the specified insurance products and related records. Returns validation status for each specified record along with resolution guidance when the CML configuration is incomplete or inconsistent.
---
# validateCMLModel(insCMLModelValidationInputRepresentation)

Validate the active CML (Constraint Markup Language) model for the specified insurance products and related records. Returns validation status for each specified record along with resolution guidance when the CML configuration is incomplete or inconsistent.

## API Version

68.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsCMLModelValidationRepresentation validateCMLModel(ConnectApi.InsCMLModelValidationInputRepresentation insCMLModelValidationInputRepresentation)

## Parameters

insCMLModelValidationInputRepresentation

Type: [ConnectApi.InsCML​Model​Validation​InputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_ins_cml_model_validation.htm "Input representation of the insurance products and related records to validate against the active CML model.")

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

Type: [ConnectApi.InsCML​Model​Validation​Representation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_ins_cml_model_validation.htm "Output representation of the per-record validation results and any top-level errors that occur when processing the request.")

## 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);