---
schema_version: "1"
id: d47da5a4844568443b2c13fde212d18a8d86e430c34b2de4f428e110eece19f2
title: validateProductModel(insProductModelValidationInputRepresentation)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_validateProductModel_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_validateProductModel_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 794b560d221ca0dfa6640b8d177a36faceaa65ff4d2abf27a7ff8a2699435216
description: Validate the setup and configuration of insurance product models at design time. Provide a root product ID to check the entire product hierarchy for configuration errors that could cause failures during quoting, rating, or policy issuance.
---
# validateProductModel(insProductModelValidationInputRepresentation)

Validate the setup and configuration of insurance product models at design time. Provide a root product ID to check the entire product hierarchy for configuration errors that could cause failures during quoting, rating, or policy issuance.

## API Version

68.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsProductModelValidationRepresentation validateProductModel(ConnectApi.InsProductModelValidationInputRepresentation insProductModelValidationInputRepresentation)

## Parameters

insProductModelValidationInputRepresentation

Type: [ConnectApi.InsProduct​Model​Validation​InputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_ins_product_model_validation.htm "Input representation of the details to validate an insurance product model.")

Required. Input that identifies the root insurance product whose model setup should be validated. The method validates this product and all associated products in its hierarchy, including direct children, component groups, and classification-based children.

## Return Value

Type: [ConnectApi.InsProduct​Model​Validation​Representation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_ins_product_model_validation.htm "Output representation of the validation results for a product model and its hierarchy.")

## Usage

Use this method at design time to validate a root insurance product and every associated product in its hierarchy, including direct children, component groups, and classification-based children. The method checks configuration that would otherwise surface as runtime failures during quoting, rating, or policy issuance.

Validations include confirming that each product is active; that the product code is specified, is a single word, and is unique; that an active record type and product specification record type mapping are present; that root-level product type is Base, Bundle, or Set; that BasedOnId points to a valid product classification; that an active product selling model and price book entry are associated; that attribute definitions have non-blank developer names and unique codes; that extended attribute reference object and field are set together and resolve in metadata; that the root product is associated with a catalog category; and that the hierarchy has no cycles or forbidden parent-child specification-type pairings.

When every product in the hierarchy passes validation, isValid is true. When one or more products fail, isValid is false and products lists the related products that have configuration errors. Examples of per-product error codes include:

- SF-INS-DSAV-00001 — the product isn’t active.
- SF-INS-DSAV-00004 — the product isn’t associated with a product selling model option.
- SF-INS-DSAV-00011 — the product doesn’t have a price book entry.
- SF-INS-DSAV-00014 — the product doesn’t have a record type assigned.
- SF-INS-DSAV-00027 — the product hierarchy contains a circular reference.

Top-level errors are returned in errors when the request can’t be validated per product. A missing productId returns SF-INS-DSAV-00013. A blank, malformed, or invalid Product2 ID returns SF-INS-DSAV-00012. Insufficient access, or Digital Insurance not enabled for the org, returns INSUFFICIENT\_ACCESS.

## Example

This sample validates a product model from Apex.

ConnectApi.InsProductModelValidationInputRepresentation input =
    new ConnectApi.InsProductModelValidationInputRepresentation();
input.productId = '01txx0000006i3DAAQ';

ConnectApi.InsProductModelValidationRepresentation result =
    ConnectApi.InsuranceDesignAdvisorFamily.validateProductModel(input);

System.debug('isValid=' + result.isValid);
System.debug('productId=' + result.productId);
System.debug('products=' + result.products);
System.debug('errors=' + result.errors);
System.debug('infos=' + result.infos);