Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to get Global Option Set text and Local Option set text based on value in plugin

Posted on by Microsoft Employee

1.I want a code to get Global Option Set text based on Global Option set value  in plugin.

2.I want a code to get Local Option Set text based on Local Option set value  in plugin.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to get Global Option Set text and Local Option set text based on value in plugin

    Thank you

  • Suggested answer
    Aileen Gusni Profile Picture
    Aileen Gusni 44,522 on at
    RE: How to get Global Option Set text and Local Option set text based on value in plugin

    Hi Akash

    Yup.

    Btw you can use to retrieve all the label like USA and Russia and so on from this code

    foreach (OptionMetadata optionMetadata in optionsetMetadata.Options)

          {

               if (optionMetadata.Value == optionsetValue)

                {

                   optionsetText = optionMetadata.Label.UserLocalizedLabel.Label;

                    return optionsetText;

                }

          }

    You just dont need to stop it under the if

    No need this one

    if (optionMetadata.Value == optionsetValue)

    Just return the whole list.

    Hopw this helps you.

    Thank you.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to get Global Option Set text and Local Option set text based on value in plugin

    Thank you maniraj

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to get Global Option Set text and Local Option set text based on value in plugin

    Aileen gusni...thank you....but can I use it for both local and global option set.....Here there is one more requirement... I want to fetch all the labels of option set...suppose option set is country it has values such as USA,Russia and so on. I want to retrieve all the values and label text of option set

  • Aileen Gusni Profile Picture
    Aileen Gusni 44,522 on at
    RE: How to get Global Option Set text and Local Option set text based on value in plugin

    Hi Akash

    You can use for both here

    [View:http://www.codeproject.com/Tips/553178/Get-the-OptionsetValue-and-OptionsetText-for-Dynam]

    Thanks

  • Suggested answer
    ManirajKV Profile Picture
    ManirajKV 1,477 on at
    RE: How to get Global Option Set text and Local Option set text based on value in plugin

    Hi Akash,

    Try this below link..

    nishantrana.me/.../get-optionset-label-using-formattedvalues-property-of-entity-in-plugin-in-crm

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans