Hi,
It is possible to get the label of optionsets in CRM. For following optionset, I would like to get the value of Label.
Label: Dryer
Schema name: new_dryer
OptionSet Name: Working
OptionSetValue: 970200001
*This post is locked for comments
Hi,
It is possible to get the label of optionsets in CRM. For following optionset, I would like to get the value of Label.
Label: Dryer
Schema name: new_dryer
OptionSet Name: Working
OptionSetValue: 970200001
*This post is locked for comments
I do have the schema name of the option set, and I would like to get label of the option set.
Okay , so are you saying you need to extract the value based on label?
Hi,
thanks for your reply. I do use following code, but it gives me back Working which is the label of the value.
RetrieveAttributeRequest raRequest = new RetrieveAttributeRequest { EntityLogicalName = "new_visit", LogicalName = "aux_dryer", RetrieveAsIfPublished = true }; RetrieveAttributeResponse raResponse = (RetrieveAttributeResponse)service.Execute(raRequest); PicklistAttributeMetadata paMetadata = (PicklistAttributeMetadata)raResponse.AttributeMetadata; OptionMetadata[] optionList = paMetadata.OptionSet.Options.ToArray(); Dictionary<int, string> dic = new Dictionary<int, string>(); foreach (OptionMetadata oMD in optionList) { return oMD.Label.LocalizedLabels.Where(x => x.LanguageCode == 1033).FirstOrDefault().Label.ToString(); //dic.Add((int)oMD.Value, oMD.Label.LocalizedLabels.Where(x => x.LanguageCode == 1033).FirstOrDefault().Label.ToString()); } return "";
Hello there,
You will have make request to crm metadata , have a look here :
c# :community.dynamics.com/.../retrieve-option-set-metadata-in-c
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156