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 CRM (Archived)

Hide option set values

(0) ShareShare
ReportReport
Posted on by 1,942

Hi all,

I am trying to hide the values in an options using the below library and it is working fine so far.

Xrm.Page.getControl().removeOption();

The option set is created from a global option set and seems to be an issue in hiding the values.

Any idea on to approach this?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    local and global optionsets have no difference when using the removeOption command

    of course the script will work only inside the forms where your js library is called

  • Vighnesh Profile Picture
    1,942 on at

    Hi Guido,

    It is called on load of lead record. Below is my complete code. Unfortunately i am still able to see the value.

    function hidevalues(){

    debugger;

    Xrm.Page.getControl("new_leadtype").removeOption(100000003);

    Xrm.Page.getControl("new_leadtype").removeOption(100000002);

    Xrm.Page.getControl("new_leadtype").removeOption(100000005);

    Xrm.Page.getControl("new_leadtype").removeOption(100000022);

    Xrm.Page.getControl("new_leadtype").removeOption(100000017);

    Xrm.Page.getControl("new_leadtype").removeOption(100000021);

    Xrm.Page.getControl("new_leadtype").removeOption(100000023);

    Xrm.Page.getControl("new_leadtype").removeOption(100000009);

    Xrm.Page.getControl("new_leadtype").removeOption(100000019);

    Xrm.Page.getControl("new_leadtype").removeOption(100000006);

    Xrm.Page.getControl("new_leadtype").removeOption(100000001);

    Xrm.Page.getControl("new_leadtype").removeOption(100000015);

    }

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Vighnesh,

    Your code is correct. There is no way to have an issue with this. Please refer the thread below.

    community.dynamics.com/.../187171

    Also refer this blog.

    crmdynamicblog.blogspot.in/.../remove-item-from-picklist.html

  • Community Member Profile Picture
    on at

    Also check if you have correct optionset values and proper control name.

  • Suggested answer
    Alagunellaikumar Profile Picture
    6,212 on at

    Hi

    Could you please cross verify your values or debug it whether it hit this line or not? The above code is correct

  • Verified answer
    tw0sh3ds Profile Picture
    5,600 on at

    Hi,

    Maybe you have this field in header? In header you have to add "header_" prefix to your field name. Here is some example:

    community.dynamics.com/.../javascript-work-with-fields-in-header-and-business-process-flow

  • Saddamk206 Profile Picture
    777 on at

    Hi,

    Also can try this:-

    for (var i = 0; i < Xrm.Page.getAttribute("FieldName").getOptions().length; i++)
    {

    Xrm.Page.getControl("FieldName").removeOption(Xrm.Page.getAttribute("FieldName").getOptions()[i].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 CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans