---
schema_version: "1"
id: 0f548c16caaccf56d78899bfeb56afc6375e8cd75bc3d9d920b1f516447b30f6
title: validateAttributes(insAttributeValidationInputRepresentation)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_validateAttributes_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_validateAttributes_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4bf9ced96e560ce41f359bdb1794cf0e18384ec1a015dab4aa61975bfcd78f14
description: Validate that the specified attribute definitions exist in the org and are active. This method returns a per-attribute validation status with resolution guidance for any attribute that can't be validated.
---
# validateAttributes(insAttributeValidationInputRepresentation)

Validate that the specified attribute definitions exist in the org and are active. This method returns a per-attribute validation status with resolution guidance for any attribute that can't be validated.

## API Version

68.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsAttributeValidationRepresentation validateAttributes(ConnectApi.InsAttributeValidationInputRepresentation insAttributeValidationInputRepresentation)

## Parameters

insAttributeValidationInputRepresentation

Type: [ConnectApi.InsAttribute​Validation​InputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_ins_attribute_validation.htm "Input representation of the attribute definitions to validate. Each lookup identifies one attribute definition by ID, code, or developer name.")

Required. List of attribute definitions to validate. Identify each attribute by ID, code, or developer name. The method confirms that each definition exists in the org and is active, and returns resolution guidance for any attribute that can't be validated. Specify a context definition ID when you need to resolve dynamic context attributes.

## Return Value

Type: [ConnectApi.InsAttribute​Validation​Representation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_ins_attribute_validation.htm "Output representation of the per-attribute validation results. Each result reports whether the attribute definition exists and is active, and includes resolution guidance when it isn't.")

## Usage

Use this method at design time to confirm that attribute definitions referenced in a product model, constraint model, or request payload exist in the org and are active. You can directly call this method or use this method from the Insurance Design Advisor agent to check the validity of the attribute definitions, before the attribute definitions are used.

For each attribute lookup, the method checks that at least one of attributeId, attributeCode, or attributeName is provided, that an AttributeDefinition record exists, and that the record is active (IsActive is true). Lookups are resolved by attribute ID, then attribute code, and then developer name.

Each result sets isValid to true when the attribute definition is valid. When the attribute is invalid, instructions contains the resolution guidance. Per-attribute failures use these error codes:

- SF-INS-DSAV-00030 — the attribute definition wasn't found.
- SF-INS-DSAV-00031 — the attribute definition is inactive.
- SF-INS-DSAV-00032 — the lookup didn't include an attribute ID, code, or developer name.

The method resolves lookups in bulk. Regardless of how many attributes you specify, the method issues at most three queries, one for each identifier type, and then matches every lookup in memory against those results.

## Example

This is a sample code to validate an attribute definition from Apex.

ConnectApi.InsAttributeInputRepresentation attr =
    new ConnectApi.InsAttributeInputRepresentation();
attr.attributeName = 'Limit';

ConnectApi.InsAttributeValidationInputRepresentation input =
    new ConnectApi.InsAttributeValidationInputRepresentation();
input.attributeLookups = new List<ConnectApi.InsAttributeInputRepresentation>{ attr };

ConnectApi.InsAttributeValidationRepresentation result =
    ConnectApi.InsuranceDesignAdvisorFamily.validateAttributes(input);

System.debug('isValid=' + result.isValid);
System.debug('attributes=' + result.attributes);
System.debug('errors=' + result.errors);