Hi All,
I need to hide/show values in an option set based on other fields. I am able to hide the options no problem using:
formContext.getControl("controlname").removeOption(100000002)
However, when I try use the formContext.getControl("controlname").addOption(100000002) to show the value again I get the following error when stepping through the code: Uncaught UciError: Required Parameter is null or undefined: optionSetItem.value
Based on the Microsoft Documentation don't see any parameters to add (https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/addoption).
Am I missing something?
Thanks Mehdi! You always seem to save my day! Appreciate it.
I did not read close enough to see it required an object not value.
Hi,
you need to add an object, not a number.
Example:
formContext.getControl("controlname").addOption({value:100000002,text:'OptionText'});
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156