web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get label of a CRM field

(0) ShareShare
ReportReport
Posted on by

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 have the same question (0)
  • Verified answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hello there,

    You will have make request to crm metadata , have a look here :

    c# :community.dynamics.com/.../retrieve-option-set-metadata-in-c

    JS : nishantrana.me/.../retrieve-optionset-label-using-sdk-metadata-rertrieveattribute-method-in-javascript-crm-2011  

  • Jorge S Profile Picture
    on at

    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 "";


  • Rawish Kumar Profile Picture
    13,758 on at

    Okay , so are you saying you need to extract the value based on label?

  • Jorge S Profile Picture
    on at

    I do have the schema name of the option set, and I would like to get label of the option set.

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans