Get Option Set Name in Dynamics CRM.
We can retrieve Option Set name of dynamics CRM entities using StringMap entity.
StringMap entity: Stringmap entity basically used in MSCRM for storing the details of Option Set Fields exists in an organization. It contains all the data (Attribute Name, Option Set name, option value, option name, Object Type Code) of option set.
How to get Option Set Name?
We can simply join our entity with String Map entity and get name for option set fields.
Example: We want to retrieve all option set name of Case Priority.
Option Set Values without using Stringmap entity.
Script:
Query: select TicketNumber,prioritycode AS Priority
from Incident
Output:
Option Set Values using Stringmap entity.
Script:
select TicketNumber,prioritycode AS PriorityCodeValue , SM.Value AS PriorityCodeName
from Incident AS I
left join StringMap AS SM on I.PriorityCode=SM.AttributeValue
where SM.AttributeName='prioritycode' and SM.ObjectTypeCode='112'
Output:
How to get entity ObjectTypeCode?
Script:
select
OriginalLocalizedName,OriginalLocalizedCollectionName,Name,ObjectTypeCode
from EntityView order by ObjectTypeCode
Why entity ObjectTypeCode is required?
We can create global option set and use them in multiple entities so if we are required to get entity specific values then we need to provide ObjectTypeCode.
If you have further queries/seek clarification, please do let me know.
Also, please do not forget to share your valuable feedback. It means a lot to me.
1 Percent better Every day.
If you have further queries/seek clarification, please do let me know.
Also, please do not forget to share your valuable feedback. It means a lot to me.1 Percent better Every day.



Comments
Post a Comment