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?

  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
11manish Profile Picture

11manish 71 Super User 2026 Season 2

#2
Travis South Profile Picture

Travis South 45

#3
Ayesha Wajahat Profile Picture

Ayesha Wajahat 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans