How are optionsets stored in CRM 2011 DB

I ran into a question while working on a project on how Option sets were stored in CRM 2011. I started looking into the DB and it looks pretty straight forward. Any option sets including the Global and non Global(I guess you could call them that) are stored in three tables:

1. OptionSetIds - This table contains just a column which contains a unique identifier for each new OptionSet that you create.

2. MetadataSchema.AttributePicklistValue - OptionSet Values are primarily indicated by the value stored in this table. It is stored in the Value column in this table.

3. MetadataSchema.LocalizedLabel - This is where the Option Set Label Value is stored. Just matchup the AtributePicklistValueId in MetadataSchema.AttributePicklistValue against the ObjectId in MetadataSchema.LocalizedLabel/

 

This breakup allows for localization of the OptionSet Labels........

Comments

  • Anonymous
    January 14, 2013
    I am using CRM2011 Online with a SilverLight app, using OData, but I cannot find an example where someone use the csdl class to get a list of Global OptionSet labels and values.  Do you know of a link with an example? Thanks

  • Anonymous
    August 25, 2015
    select v.Value, l.Label from MetadataSchema.AttributePicklistValue v inner join MetadataSchema.LocalizedLabel l on v.AttributePicklistValueId = l.ObjectId and l.ObjectColumnName = 'DisplayName' inner join MetadataSchema.OptionSet o on v.OptionSetId = o.OptionSetId where o.name = '<Name of Options set>'