Notifications
Announcements
No record found.
I have Custom Entity New_Entity , Which has OptionSet(New_Type) with Values Male and Female (id,100 and 101).
I want to read these values from C# , i need ids in c# code(100,101).
How can i read these values from CRM in C#, Please help
Thanks,
Hi,
you can refer below post.
Multi select optionset
community.dynamics.com/.../282806
docs.microsoft.com/.../multi-select-picklist
Optionset
https://community.dynamics.com/crm/f/117/t/250277
You should be able to get the field value as follows-
var IndustryOptionSet= (OptionSetValueCollection)targetEntity["new_industry"];
if(IndustryOptionSet != null)
{
var IndustryValue = IndustryOptionSet.Value;
}
Hope this help.
Hi ,
You an also write like below -
int? type = null; if (_entity.Attributes.Contains("New_Type")) { if (Convert.ToString(_entity.Attributes["New_Type"]) != "" && (_entity.Attributes["New_Type"] as OptionSetValue) != null) { type = (_entity.Attributes["New_Type"] as OptionSetValue).Value; } }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to a top community star!
In our never-ending quest to help the Dynamics 365 Community members get answers faster …
Welcome to the next edition of the Community Platform Update. This is a status …
Stay up to date on forum activity by subscribing.