Wednesday, August 02, 2017

Dynamics CRM–Retrieving optionset values from the database

SELECT o.name,
        a.Value,
        l.label
FROM AttributePicklistValueView a
      JOIN OptionSetView o ON o.OptionSetId = a.OptionSetId
      JOIN LocalizedLabelView l ON l.ObjectId = a.AttributePicklistValueId
WHERE o.Name = ‘optionSetName';