Tuesday, August 9, 2016

How to retrieve the value of an Optionset in Dynamics CRM?

In Microsoft Dynamics CRM, OptionSet labels are stored in stored in the StringMapBase table in Dynamics CRM DB. So, Whenever you need to get the optionset label. You'll have to query that table i.e

 SELECT 

        [ObjectTypeCode] AS 'Object Type Code',
        [AttributeName] AS 'Optionset Name',
        [AttributeValue] AS 'Optionset Item Value',

        [Value] AS 'Optionset Item Text',
        [DisplayOrder] AS 'Display Order',

        [VersionNumber] AS 'Version Number',
        [StringMapId] AS 'String Map ID',

        [LangId] AS 'Lang GUID',
        [OrganizationId] AS 'Organization'
  FROM [StringMap]
  WHERE AttributeName = 'YourOptionSetName'



CHEERS!!

No comments:

Post a Comment