Reputation: 151
I am working on a report that pulls some data from CRM and for some reason the real value text I need is in the description of the option set choice. For the life of me I can not find it in the entity's StringMap's, or attributes's views. Help!!
Upvotes: 0
Views: 545
Reputation: 2980
I initially read the question incorrectly which prompted me to go down the wrong path. To get the "Description" use the following query:
SELECT DISTINCT ATTR.NAME, LOCLAB.LABEL AS DESCRIPTION
FROM [ORG_MSCRM].[MetadataSchema].[Entity] ENT
LEFT JOIN [ORG_MSCRM].[METADATASCHEMA].[ATTRIBUTE] ATTR
ON ENT.ENTITYID = ATTR.ENTITYID
LEFT JOIN [ORG_MSCRM].[METADATASCHEMA].[ATTRIBUTEPICKLISTVALUE] ATTRPICK
ON ATTR.OPTIONSETID = ATTRPICK.OPTIONSETID
LEFT JOIN [ORG_MSCRM].[METADATASCHEMA].[LOCALIZEDLABEL] LOCLAB
ON LOCLAB.OBJECTID = ATTRPICK.ATTRIBUTEPICKLISTVALUEID
WHERE ENT.OBJECTTYPECODE ='2' --contact
AND ATTR.NAME = 'GENDERCODE' --attributename
AND LOCLAB.OBJECTCOLUMNNAME = 'DESCRIPTION'
Upvotes: 2