Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Custom control optionset doesn't support addOption, removeOption and clearOptions

(0) ShareShare
ReportReport
Posted on by 200

Hi,

we are using a optionset custom control on an optionset on a form inside an Unified Interface app.

It seems that the formContext.getControl(arg) doesn't contain functions to add, remove or clear options from the optionset.
If we are opening up the form in a web app it works fine (Since it doesnt use the custom control if not in Unified Interface).

Is it possible to do this in another way?

  • Suggested answer
    Rickards08 Profile Picture
    Rickards08 200 on at
    RE: Custom control optionset doesn't support addOption, removeOption and clearOptions

    I reported this to Microsoft and the fix is being released online in version 9.1.0.4832.

    Still no word on OnPremise.

    Link: github.com/.../1100

  • Rickards08 Profile Picture
    Rickards08 200 on at
    RE: Custom control optionset doesn't support addOption, removeOption and clearOptions

    Hi,

    this works if we arent using the CustomControl.

    If you want to try this out.

    Open your optionset control properties in the form editor.

    Chose the controls tab and the add the optionset control and activate it for the web.

    Then reload the form in the unified interface app.

    Now you will see the mobile control "custom control" is used instead of the "normal optionset control".

    When you now try to use addOption or removeOption they won't be on the control object.

    Please try that and If you figure it out, get back to me :)

    2100.Capture.PNG

  • LeoAlt Profile Picture
    LeoAlt 16,331 on at
    RE: Custom control optionset doesn't support addOption, removeOption and clearOptions

    Hi partner,

    Did you try to use "Xrm.Page.getControl(arg).addOption({value,text})" instead?

    For example:

    Xrm.Page.getControl("purchaseprocess").addOption({value:100000000,text:"Test1"})


    It worked both in classic web and unified interface.

    community414.png

    community414.png

    Here is also a blog for you to refer to.

    https://community.dynamics.com/crm/b/crmtipsfromadeveloper/archive/2017/08/19/know-how-d365-crm-javascript-optionset-related-methods-get-set-add-remove-retrieve-all-remove-all

    Hope it helps.

    Best Regards,

    Leo

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans