Export (0) Print
Expand All

Data Validation and Default Values

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

In earlier versions of Microsoft Dynamics CRM, much of the data validation was done at the application level. If you created an entity instance using the SDK, some data types were not validated. Similarly, if a default value was specified for an attribute, the default was not set when you created an entity instance using the SDK. Microsoft Dynamics CRM adds data validation and default value support at the SDK level. This validation occurs before any other execution pipeline operations, that is before any pre-create plug-ins are invoked.

Note that this feature only applies to the 2007 endpoint. SDK calls made using the 2006 endpoint are not subject to data validation or default value support.

Supported Validation

The following table shows the supported data validation for each attribute type.

Attribute typeClass nameValidation support
BooleanCrmBooleanValidation of option value
Text or memoStringMaximum string length
Integer or numberCrmNumberMinimum and maximum values
Numeric or moneyCrmDecimal

CrmFloat

CrmMoney

Minimum and maximum values

Precision1 (number of decimal places)

PicklistPicklistValidation of option value
State and StatusStatus

EntityNameStateInfo

Validation of option value

1 All validation errors other than precision result in throwing an error. For precision, the value is rounded up. For example, assuming the precision is 2, a value set to 11.3456 will be rounded to 11.35 when the record is saved.

Default Values

When you create an entity instance using the Create method or the Create message, you supply an instance of the entity class that contains the values for the new entity instance. If you leave any of the properties null, the system will fill in the default values if a default is specified in the metadata for the attribute.

If you set the IsNullSpecified property to true, default values will not be applied. For more information about how to set null values, see Assigning Null Values.

Default values are not filled in when you use the Update method or the Update message.

See Also

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft