Posts

Showing posts from June, 2023

Get option-set value from text and get option-set text from Value using plugin

Image
In this blog we will discuss the use of StringMap table to get option-set metadata in our CRM plugin. StringMap table holds the metadata information of option-sets. The StringMap table contains the following important columns: "Value": This column stores the string value assigned to each picklist option. "AttributeName": This column contains the logical name of the attribute associated with the picklist values. "AttributeValue": This column stores the numeric value assigned to each picklist option. Numeric value assigned to picklist option is unique. "ObjectTypeCode": Object type code of entity for which attribute belongs. Code snippet to get option-set Value from Text: static int? GetOptionSetValueFromText(IOrganizationService service, string optionSetSchemaName, string optionSetText, int objectTypeCode) { string fetch = @"<fetch> <entity name='stringmap' > <attribute name='value' /> <attribut