web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Hide/Show values in optionSet?

(1) ShareShare
ReportReport
Posted on by 99

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?

I have the same question (0)
  • Verified answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hi,

    you need to add an object, not a number.

    Example:

    formContext.getControl("controlname").addOption({value:100000002,text:'OptionText'});

  • mykedeabreu Profile Picture
    99 on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans