Sunday, October 16, 2011

get the picklist string and index values by query in ms cmr 2011

some times we need to write sql queries in ms crm for fetching values from ms crm database.
so if we need the picklist values( string values), we need to fetch a different table than the entity table.
crm stores all in StringMap table

Get objecttypecode:-

SELECT * 

FROM StringMap INNER JOIN MetadataSchema.Entity ON StringMap.ObjectTypeCode = MetadataSchema.Entity.ObjectTypeCode

where StringMap.AttributeName Like @attribute

get value:-

SELECT  Value as Status
FROM @entity e
LEFT JOIN StringMap ON
@attribute = AttributeValue AND
ObjectTypeCode = @objecttypecode AND AttributeName = @attribute


hope this helps anyone in any corner...

No comments:

Post a Comment