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
Hi Shreya,
Please refer to this link for getting optionset metadata using WebAPI: community.dynamics.com/.../293287
Hi Kalpavruksh,
Thanks for your reply.
The above specified code is working. Can you share the code which returns multiple optionset values?
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);
}
formContext.getAttribute("statuscode").getText();
Or you can check this thread for alternate solutions