Hello all!
How do I retrieve multi select option set field from crm using C#?
I tried this but it doesn't seem to work and it's a bit too advanced to me to debug.
Can anyone show me how it's done?
Thank you!
*This post is locked for comments
Hello all!
How do I retrieve multi select option set field from crm using C#?
I tried this but it doesn't seem to work and it's a bit too advanced to me to debug.
Can anyone show me how it's done?
Thank you!
*This post is locked for comments
You have to use latest 9.0 SDK dll i.e (include refer Microsoft.Crm.Sdk.Proxy.dll and Microsoft.Xrm.Sdk.dll in your c# Project)
To get 9.0 sdk from nuget use this link.
By using below code you will get the collection from MultiSelect Option set as shown in below screen shot:
Thanks!
Hi Heimmu,
The article that was written by Alex Shlega was to provide the ability to query multiselect optionsets prior to the availability of the SDK, which contains the OptionSetValueCollection collection. Building it at this point, while the SDK provides you with that functionality is completely unnecessary.
At this point, you can use:
OptionSetValueCollection ovc = (OptionSetValueCollection)result["new_myOptionset"];
This will return the Collection of Values in the OptionSet.
You can the loop through the values in the collection to retrieve the individual values.
Hope this helps.
Hi Heimmu,
try something like this
QueryExpression queryAccount = new QueryExpression(); queryAccount.EntityName = EntityName; queryAccount.ColumnSet.Columns.Add("new_multiselectoptionset"); queryAccount.Criteria.AddCondition("name", ConditionOperator.Equal, "account name"); EntityCollection ec = _orgService.RetrieveMultiple(queryAccount); foreach (var item in ec.Entities) { OptionSetValueCollection op= (OptionSetValueCollection)item["new_multiselectoptionset"]; foreach (var options in op) { int i = options.Value; } }
Thanks
Justin Jose
You share your code here so someone can look into that.
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