Notifications
Announcements
No record found.
formContext.getAttribute("address1_addresstypecode").getSelectedOption().value;
formContext.getAttribute("address1_addresstypecode").getSelectedOption().text;
Yes! You can retrieve the values (both numeric and label) of a Choice (Option Set) field in Dynamics 365 using JavaScript.
var purchaseProcessField = Xrm.Page.getAttribute("purchaseprocess"); if (purchaseProcessField) { var selectedValue = purchaseProcessField.getValue(); var selectedLabel = purchaseProcessField.getText(); console.log("Value:", selectedValue, "Label:", selectedLabel); }
var options = Xrm.Page.getAttribute("purchaseprocess").getOptions(); options.forEach(function(option) { console.log("Value:", option.value, "Label:", option.text); });
If you're using the newer formContext model:
var formContext = executionContext.getFormContext(); var options = formContext.getAttribute("purchaseprocess").getOptions(); options.forEach(function(option) { console.log("Value:", option.value, "Label:", option.text); });
Best regards,
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
iampranjal 51
Martin Dráb 39 Most Valuable Professional
André Arnaud de Cal... 26 Super User 2025 Season 2