Hi e0209,
Yes, we can also get description of a selected option by retrieving metadata of a specific optionset field of a specific entity.
e.g: The code below will retrieve description of the value of "Preferred Method of Contact" option set of Contact entity.(We still fire the function at the field onChange event.)
function onChangeOfOptionSet(executionContext) {
var formContext = executionContext.getFormContext();
// Clear notification bar
formContext.ui.clearFormNotification();
// Set notification bar
var option = formContext.getAttribute('preferredcontactmethodcode').getSelectedOption().text;
var req = new XMLHttpRequest();
req.open("GET", formContext.context.getClientUrl() "/api/data/v9.1/EntityDefinitions(LogicalName='contact')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$filter=LogicalName eq 'preferredcontactmethodcode'&$expand=OptionSet", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var results = JSON.parse(this.response);
for (var i = 0; i < results.value[0].OptionSet.Options.length; i ) {
var Label = results.value[0].OptionSet.Options[i].Label.UserLocalizedLabel.Label;
if (option === Label) {
formContext.ui.setFormNotification(results.value[0].OptionSet.Options[i].Description.UserLocalizedLabel.Label, 'INFO');
}
}
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
}
Let's test code above:
Description value of Any, Email and Phone



Result:



If no option is selected or if there is description for selected option, then notification bar won't appear.
Regards,
Clofly