Skip to main content

Notifications

Customer Service forum

Custom button to popup HTML web resource -not able to get optionset text

Posted on by 62

Hi,

I have a custom button on user to show the list of records from another custom entity on click of a button using HTML webresource.

One of the columns has a field type as optionset and I am not able to show the text of an optionset. Webapi is returning integer values. Is there any way to get the optionset text?

Any help would be appreciated!

Thanks,

Shreya K

Categories:
  • Verified answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: Custom button to popup HTML web resource -not able to get optionset text

    Hi Shreya,

    Please refer to this link for getting optionset metadata using WebAPI: community.dynamics.com/.../293287

  • Shreya kamble Profile Picture
    Shreya kamble 62 on at
    RE: Custom button to popup HTML web resource -not able to get optionset text

    Hi Kalpavruksh,

    Thanks for your reply.

    The above specified code is working. Can you share the code which returns multiple optionset values?

  • Verified answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: Custom button to popup HTML web resource -not able to get optionset text

    Hi Shreya,

    Please use the following code to get the text of an optionset to be displayed in HTML webresource: 

    oUser.typeoflicense = oResult.value[i]["<fieldSchemaName>@OData.Community.Display.V1.FormattedValue"];

    For example:

    var fieldschemaname = "new_optionset";
    var oUser = { type: ""};
    if (oResult.value[i]["new_optionset"]) {

    oUser.type= oresult.value[i]["new_optionset@odata.community.display.v1.formattedvalue"];

    oConstants.oUsersData.array.push(oUser);
    }

  • Suggested answer
    T.I.A Profile Picture
    T.I.A 1,760 on at
    RE: Custom button to popup HTML web resource -not able to get optionset text

    formContext.getAttribute("statuscode").getText();

    Or you can check this thread for alternate solutions

    community.dynamics.com/.../167882

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

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