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)

OptionSet - retrieve selected value 'Description' in Javascript

(0) ShareShare
ReportReport
Posted on by 2,601

I know the below code allows the retrieval of text/value from an optionset but I want to retrieve the description (which is entered when setting up the optionset).  

Is this possible?

Get the value from a CRM OptionSet field

var value = Xrm.Page.getAttribute(“CRMOptionSetSchemaName”).getValue();

Get the text from a CRM OptionSet field

var text = Xrm.Page.getAttribute(“CRMOptionSetSchemaName”).getText();

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Hosk Profile Picture
    on at

    Sorry there isn't a way you can retrieve the optionSet description

    The only way to get this information is set it up somewhere else in the CRM and then retrieve it but that would mean inputting again somewhere else and arranging it so you could look it up.

  • Verified answer
    jlattimer Profile Picture
    24,562 on at

    You would need to query the metadata - which you can do using JavaScript.

    Sample: Retrieve Entity Metadata Using JavaScript

  • Suggested answer
    Karth Profile Picture
    on at

    What's the purpose of retrieving the description? If the purpose is to display them as tooltips and you are currently using CRM 2013, then the descriptions are displayed as a tooltip when you hover over a field label on a form.

  • Verified answer
    CU21020959-0 Profile Picture
    2,601 on at

    I was planning to use the description held in the optionsets to hide/show another optionset.  On reflection I can use the optionset  ID as it's a global optionset and the IDs will not change.

  • Community Member Profile Picture
    on at

    I need the same things. We are building solution for one of our clients. As you know Microsoft doesn't support lookup fields in offline mode for mobile application (Resco supports long time ago, don't understand their awesome offline functionality.....) and we decided to create instead of lookup fields the option sets, but we need to retrieve description where we held our GUID for records. So there is no another way how to retrieve description from Option Set? Can someone provide any advise or suggestions.

    Thanks guys.

  • Kenny Vaes Profile Picture
    345 on at

    Best guess would be the metadata. Check out this section in the documentation.

    https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.metadata.optionmetadata_properties.aspx

    Each optionsetvalue should be returned in the OptionSetMetadata as OptionMetadata. Seems like this last one contains the description field. Never tried it myself.

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