How to get Microsoft CRM 2011 field attributes

How to get CRM field attributes

Say you need to know what all the Required Fields are or list of other field attributes like MaxLength or MinValue, for a set of entities in Microsoft Dynamics CRM 2011, you could open each entity one at a time and then open each field attribute to determine its requirement level but if you have a large solution that process is time consuming and tedious.

A quick simple solution is to query the MetadataSchema.Attribute and the MetadataSchema.Entity found  in the Microsoft Dynamics CRM 2011 Organization database.  Using the SQL I have provided below you can get a listing of just about anything you might want to know about your solutions entity attributes and field attributes.

 

SELECT MetadataSchema.Attribute.Name,   MetadataSchema.Attribute.AttributeRequiredLevelId,   MetadataSchema.Attribute.PhysicalName, MetadataSchema.Attribute.Length,

MetadataSchema.Attribute.MaxLength,   MetadataSchema.Attribute.DefaultValue,   MetadataSchema.Attribute.VisibleToPlatform,   MetadataSchema.Attribute.IsPKAttribute,

MetadataSchema.Attribute.PrecisionValue,   MetadataSchema.Attribute.MinValue, MetadataSchema.Attribute.MaxValue,   MetadataSchema.Attribute.AttributeId,

MetadataSchema.Entity.Name,   MetadataSchema.Entity.OriginalLocalizedName

FROM    MetadataSchema.Entity INNER JOIN

MetadataSchema.Attribute ON   MetadataSchema.Entity.EntityId = MetadataSchema.Attribute.EntityId

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s